home *** CD-ROM | disk | FTP | other *** search
Text File | 2003-07-17 | 134.4 KB | 4,222 lines |
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: 6 November 1998
- //
- // Description:
- // This file contains all of the methods needed to run
- // the Render Globals window. Render Globals change
- // the information that is system-wide (as opposed to
- // object-specific) and affects the renderer.
- //
-
- // We ignore
- // defaultRenderGlobals.useMayaFileName
- // defaultRenderGlobals.animationRange
-
-
- global proc updateFileOutputFeedback ()
- //
- // Procedure Name:
- // updateFileOutputFeedback
- //
- // Description:
- // Updates lines of text that allow the user to see
- // what files are going to be created when they render.
- //
- {
- string $title1 = " File Name: ";
- string $title2 = " To: ";
-
- string $prefix = `textFieldGrp -query -text fileName`;
- if ($prefix == "(not set; using filename)") {
- string $sceneName = `file -q -sn`;
- if (size($sceneName) == 0) {
- $prefix = "untitled";
- } else {
- string $buffer[];
- tokenize $sceneName "/\\:" $buffer;
- string $tail = $buffer[size($buffer) - 1];
- tokenize $tail "." $buffer;
- $tail = $buffer[0];
- $prefix = $tail;
- }
- }
-
- // Image extension
- string $imageType;
- int $imageUse = `getAttr "defaultRenderGlobals.outFormatControl"`;
- if ($imageUse == 1) {
- // Don't use extension
- $imageType = "";
- } else if ($imageUse == 0) {
- // Show the extension
- global string $imgExt[]; // This is the actual file extension
- global int $imgExtNum[]; // This is the corresponding internal value
-
- int $imageNum = `getAttr "defaultRenderGlobals.imageFormat"`;
- for ($i=0; $i < size($imgExtNum); ++$i) {
- if ($imageNum == $imgExtNum[$i]) {
- $imageType = "."+$imgExt[$i];
- break;
- }
- }
- } else if ($imageUse == 2) {
- // User specified
- $imageType = "."+`getAttr "defaultRenderGlobals.outFormatExt"` ;
- }
-
- // Frames number extension
- string $frame1 = "";
- string $frame2 = "";
- int $useAnim = `getAttr "defaultRenderGlobals.animation"`;
- if ($useAnim) {
- // if useAnim, make sure it's not a movie format, or else
- // bad extension names will be printed out to the window.
- int $imgFormat = `getAttr "defaultRenderGlobals.imageFormat"`;
- if ($imgFormat == 21 || $imgFormat == 22 || $imgFormat == 23)
- $useAnim = 0;
- }
- if ($useAnim) {
- float $byf = `getAttr defaultRenderGlobals.byFrameStep`;
- if ($byf == 0.0) $byf = 0.00001;
-
- int $pad = `getAttr "defaultRenderGlobals.extensionPadding"`;
- int $f1 = `getAttr "defaultRenderGlobals.startFrame"`;
- int $f2 = `getAttr "defaultRenderGlobals.endFrame"`;
- int $numFrames = ($f2 - $f1) / $byf;
-
- // Check to see if the numbers are being modified
- if (`getAttr "defaultRenderGlobals.modifyExtension"`) {
- $f1 = `getAttr defaultRenderGlobals.startExtension`;
- $f2 = $f1 + ($numFrames * `getAttr defaultRenderGlobals.byExtension`);
- }
-
- // Convert to strings
- $frame1 = $f1;
- $frame2 = $f2;
-
- // Pad the numbers
- for ($i=size($frame1); $i<$pad; $i++) {
- $frame1 = "0"+$frame1;
- }
- if (`getAttr "defaultRenderGlobals.periodInExt"`)
- $frame1 = "."+$frame1;
-
- for ($i=size($frame2); $i<$pad; $i++) {
- $frame2 = "0"+$frame2;
- }
- if (`getAttr "defaultRenderGlobals.periodInExt"`)
- $frame2 = "."+$frame2;
- }
-
- // Check for fields
-
- string $fieldExt = "";
- int $whichFields = `getAttr defaultResolution.fields`;
- int $useFields = ($whichFields != 0);
- int $useFieldExt = (`getAttr "defaultRenderGlobals.fieldExtControl"` != 1);
- int $defFieldExt = (`getAttr "defaultRenderGlobals.fieldExtControl"` == 0);
- int $useCustom = (`getAttr "defaultRenderGlobals.fieldExtControl"` == 2);
-
- // Note that I am not using a "." in front of these.
- // That's the way the code works now.
- // I think that there should be a "."
- //
- if ($useFields && $useFieldExt) {
- // Add fields to the file name
- if ($defFieldExt) {
- if ($whichFields == 1) $fieldExt = "o";
- if ($whichFields == 2) $fieldExt = "e";
- if ($whichFields == 3 || $whichFields == 4) $fieldExt = "e (o)";
- } else if ($useCustom) {
- if ($whichFields == 1) $fieldExt = `getAttr "defaultRenderGlobals.oddFieldExt"`;
- if ($whichFields == 2) $fieldExt = `getAttr "defaultRenderGlobals.evenFieldExt"`;
- if ($whichFields == 3 || $whichFields == 4) $fieldExt = `getAttr "defaultRenderGlobals.oddFieldExt"`
- + " (" + `getAttr "defaultRenderGlobals.evenFieldExt"` + ")";
- }
- }
-
- // Now put them all together to show what is going to happen
- int $frameBeforeExt = `getAttr "defaultRenderGlobals.putFrameBeforeExt"`; // 0=ext.frame, 1=frame.ext
- if ($frameBeforeExt == 0) {
- text -edit -label ($title1+$prefix+$imageType+$frame1+$fieldExt) exampleText1;
- if ($useAnim) {
- text -edit -label ($title2+$prefix+$imageType+$frame2+$fieldExt) exampleText2;
- } else {
- text -edit -label "" exampleText2;
- }
- } else {
- text -edit -label ($title1+$prefix+$frame1+$fieldExt+$imageType) exampleText1;
- if ($useAnim) {
- text -edit -label ($title2+$prefix+$frame2+$fieldExt+$imageType) exampleText2;
- } else {
- text -edit -label "" exampleText2;
- }
- }
- }
-
- global proc int validFileNamePrefix(string $prefix)
- {
- int $isValid = 1;
-
- if (match("[\\/:*?\"<>| !$]", $prefix) != "") {
- // Most of these characters may not occur in NT filenames
- // The ' ', '!' and '$' are troublesome on Unix.
- catch (error ("File name prefix contains invalid character(s)."));
- $isValid = 0;
- }
- return $isValid;
- }
-
- global proc int multiframeFormat(string $format)
- {
- int $isMultiframe = 0;
-
- $isMultiframe = $format == "qt" || $format == "avi" || $format == "mv";
-
- return $isMultiframe;
- }
-
- //==================================================================
- //
- // Starting the UI updating section
- //
- //==================================================================
-
- global proc updateImageDirectory ()
- //
- // Procedure Name:
- // updateImageDirectory
- //
- // Description:
- // Shows the Project image directory that the rendered
- // images will be written to.
- //
- {
- setParent renderGlobalsWindow;
-
- // relative path, get the project's image directory
- //
- string $fileRules[] = `workspace -q -rt`;
- int $i;
- string $imageDir = ""; // default
- for ( $i = 0; $i < size($fileRules); $i += 2 ) {
- if ( $fileRules[$i] == "images" ) {
- $imageDir = "/" + $fileRules[$i+1];
- break;
- }
- }
-
- $path = " Path: "+(`workspace -q -fn` + $imageDir + "/");
-
- text -edit -label $path exampleText0;
- }
-
- global proc updateImageFile ()
- //
- // Procedure Name:
- // updateImageFile
- //
- // Description:
- // Gets the real values from the nodes and sets the UI based
- // on these values. This procedure updates all of the values
- // that make up the image file name.
- //
- {
- setParent renderGlobalsWindow;
- string $globalsAttr = "defaultRenderGlobals.imageFilePrefix";
- string $prefix = `getAttr $globalsAttr`;
-
- if (size($prefix) > 0) {
- textFieldGrp -edit -text $prefix fileName;
- } else {
- textFieldGrp -edit -text "(not set; using filename)" fileName;
- }
-
- // Extension ------------------------------------------------
-
- global string $imgExt[]; // This is the actual file extension
- int $frameBeforeExt = `getAttr "defaultRenderGlobals.putFrameBeforeExt"`; // 0=ext.frame, 1=frame.ext
- int $activeMenuItem = 0;
- int $useAnim = `getAttr "defaultRenderGlobals.animation"`;
- int $imageUse = `getAttr "defaultRenderGlobals.outFormatControl"`;
- int $period = `getAttr "defaultRenderGlobals.periodInExt"`;
- int $ext = `optionMenuGrp -q -sl imageMenu` - 1;
- int $multiframe = multiframeFormat($imgExt[$ext]);
- if ($useAnim) {
- if ( $multiframe != 0 )
- {
- $activeMenuItem = 2;
- }
- else if ($imageUse == 1)
- {
- $activeMenuItem = 5;
- }
- else
- {
- if ($frameBeforeExt == 0) {
- $activeMenuItem = 4;
- } else {
- if ($period == 0)
- $activeMenuItem = 6;
- else
- $activeMenuItem = 3;
- }
- }
- } else {
- if ($imageUse == 1) {
- $activeMenuItem = 1;
- } else {
- $activeMenuItem = 2;
- }
- }
-
- optionMenuGrp -edit -sl $activeMenuItem extMenu;
-
- // Image Format ------------------------------------------------
-
- global string $imgExt[]; // This is the actual file extension
- global int $imgExtNum[]; // This is the corresponding internal value
-
- int $imageNum = `getAttr "defaultRenderGlobals.imageFormat"`;
- for ($i=0; $i < size($imgExtNum); ++$i) {
- if ($imageNum == $imgExtNum[$i]) {
- optionMenuGrp -edit -sl ($i+1) imageMenu;
- break;
- }
- }
-
- // Renderable Objects ------------------------------------------------
-
- if (`getAttr "defaultRenderGlobals.renderAll"` == 1) {
- optionMenuGrp -edit -select 1 renderObjMenu;
- } else {
- optionMenuGrp -edit -select 2 renderObjMenu;
- }
- }
-
-
- global proc updateRenderableCamera ()
- //
- // Procedure Name:
- // updateRenderableCamera
- //
- // Description:
- // Gets the real values from the nodes and sets the UI based
- // on these values. This procedure updates all of the values
- // that make up the renderable camera.
- //
- {
- // This is a fix to get around the optionMenuGrp bug (#81337)
- string $fullName = `setParent "cameraMenu"`;
- string $menuName = ($fullName+"|OptionMenu");
- setParent -m $menuName;
-
- string $allCameras[] = `ls -ca`;
- string $parents[];
- int $i;
- int $numRenderable = 0;
- string $cmd;
-
- //
- // First remove any existing menuItems; we're gonna rebuild the menu
- // from scratch each time.
-
- int $numOldMenuItems = `optionMenuGrp -q -ni cameraMenu`;
- string $oldMenuItems[] = `optionMenuGrp -q -ill cameraMenu`;
-
- for ($i = 0; $i < $numOldMenuItems; $i++) {
- deleteUI $oldMenuItems[$i];
- }
-
- // Run through the list of all of the cameras and build a
- // optionMenu of them that the user uses to select the
- // renderable camera.
- //
- // First count how many renderable cameras exist
- //
- for ($i = 0; $i < size($allCameras); $i++) {
- if (`getAttr ($allCameras[$i] + ".renderable")`) {
- $numRenderable++;
- }
- }
-
- int $firstRenderable = 0;
- for ($i = 0; $i < size($allCameras); $i++) {
- $parents = `listRelatives -p $allCameras[$i]`;
- string $thisLabel = `menuItem -label $parents[0]`;
- // Use the first renderable camera
- if (`getAttr ($allCameras[$i] + ".renderable")`) {
- $firstRenderable++;
- if ($firstRenderable == 1) {
-
- // Selected Camera -----------------------------------------
- optionMenuGrp -edit -sl ($i+1) cameraMenu;
-
- // Channels ------------------------------------------------
- checkBoxGrp -edit -v1
- `getAttr ($allCameras[$i] + ".image")` rgbChannel;
- checkBoxGrp -edit -v1
- `getAttr ($allCameras[$i] + ".mask")` alphaChannel;
- checkBoxGrp -edit -v1
- `getAttr ($allCameras[$i] + ".depth")` depthChannel;
- }
- if ($numRenderable > 1) {
- string $camLabel = $parents[0] + " (Renderable)";
- menuItem -edit -label $camLabel $thisLabel;
- }
- }
- }
- }
-
- global proc updateFrames ()
- //
- // Procedure Name:
- // updateFrames
- //
- // Description:
- // Gets the real values from the nodes and sets the UI based
- // on these values. This procedure updates all of the values
- // that make up the animation frame numbers.
- //
- {
- int $useAnim = `getAttr "defaultRenderGlobals.animation"`;
-
- // print( "updateFrames: animation " + $useAnim + "\n" );
-
- // Frames numbers ------------------------------------------------
-
- floatFieldGrp -edit
- -v1 `getAttr "defaultRenderGlobals.startFrame"`
- -enable $useAnim
- startFrame;
-
- floatFieldGrp -edit
- -v1 `getAttr "defaultRenderGlobals.endFrame"`
- -enable $useAnim
- endFrame;
-
- floatFieldGrp -edit
- -v1 `getAttr "defaultRenderGlobals.byFrameStep"`
- -enable $useAnim
- frameStep;
-
- intFieldGrp -edit
- -v1 `getAttr "defaultRenderGlobals.extensionPadding"`
- -enable $useAnim
- extPad;
-
- // Frames Options ------------------------------------------------
-
- // Only Update these if they exist.
- // The frame may not have been created yet.
- //
- if (`checkBoxGrp -exists frameCheckBox`) {
-
- int $modExt = `getAttr "defaultRenderGlobals.modifyExtension"`;
- checkBoxGrp -edit
- -v1 $modExt
- -enable $useAnim
- frameCheckBox;
-
- intFieldGrp -edit
- -v1 `getAttr "defaultRenderGlobals.startExtension"`
- -enable ($useAnim && $modExt)
- frameStartOverride;
-
- intFieldGrp -edit
- -v1 `getAttr "defaultRenderGlobals.byExtension"`
- -enable ($useAnim && $modExt)
- frameByOverride;
- }
- }
-
- global proc updateExtOptions ()
- //
- // Procedure Name:
- // updateExtOptions
- //
- // Description:
- // Gets the real values from the nodes and sets the UI based
- // on these values. This procedure updates the custom extension.
- //
- {
- int $useImage = (`getAttr "defaultRenderGlobals.outFormatControl"` != 1);
- checkBoxGrp -edit
- -v1 (`getAttr "defaultRenderGlobals.outFormatControl"` == 2)
- -enable $useImage
- imageCheckBox;
-
- int $useExt = $useImage && `checkBoxGrp -q -v1 imageCheckBox`;
- textFieldGrp -edit
- -enable $useExt
- -text `getAttr "defaultRenderGlobals.outFormatExt"`
- userExt;
- }
-
- global proc updateFieldOptions ()
- //
- // Procedure Name:
- // updateFieldOptions
- //
- // Description:
- // Gets the real values from the nodes and sets the UI based
- // on these values. This procedure updates all of the field
- // values.
- //
- {
- int $fieldType = `getAttr defaultResolution.fields` + 1;
- int $useFields = ($fieldType != 1);
- int $autoInterlace = ($fieldType == 4);
-
- // Because of 123444, the ordering of the menu and the actual
- // saved fields values are not the same, which is why the
- // below convoluted code.
- switch ($fieldType) {
- case 1:
- optionMenuGrp -edit -select 1 fieldMenu;
- break;
- case 2:
- case 3:
- optionMenuGrp -edit -select ($fieldType + 2) fieldMenu;
- break;
- case 4:
- case 5:
- optionMenuGrp -edit -select ($fieldType - 2) fieldMenu;
- break;
- }
-
-
- optionMenuGrp -edit -enable $useFields fieldDominanceMenu;
- int $oddFieldFirst = `getAttr defaultResolution.oddFieldFirst`;
- int $whichDominance = $oddFieldFirst ? 1 : 2;
- optionMenuGrp -edit -sl $whichDominance fieldDominanceMenu;
-
- if ($fieldType == 1 || $fieldType == 4)
- radioButtonGrp -edit
- -select (`getAttr defaultResolution.zerothScanline` + 1)
- -enable 0
- scanlineButtons;
- else
- radioButtonGrp -edit
- -select (`getAttr defaultResolution.zerothScanline` + 1)
- -enable 1
- scanlineButtons;
-
- int $useCustom = 0;
- if (`getAttr "defaultRenderGlobals.fieldExtControl"` == 1)
- radioButtonGrp -edit -select 1 fieldButton1;
- else if (`getAttr "defaultRenderGlobals.fieldExtControl"` == 0)
- radioButtonGrp -edit -select 1 fieldButton2;
- else {
- radioButtonGrp -edit -select 1 fieldButton3;
- $useCustom = 1;
- }
-
- radioButtonGrp -edit -enable ($useFields && !$autoInterlace) fieldButton1;
- radioButtonGrp -edit -enable ($useFields && !$autoInterlace) fieldButton2;
- radioButtonGrp -edit -enable ($useFields && !$autoInterlace) fieldButton3;
-
- textFieldGrp -edit
- -text `getAttr "defaultRenderGlobals.oddFieldExt"`
- -enable ($useFields && $useCustom)
- oddFieldExt;
-
- textFieldGrp -edit
- -text `getAttr "defaultRenderGlobals.evenFieldExt"`
- -enable ($useFields && $useCustom)
- evenFieldExt;
- }
-
- global proc updateResolution ()
- //
- // Procedure Name:
- // updateResolution
- //
- // Description:
- // Gets the real values from the nodes and sets the UI based
- // on these values. This procedure updates all of the resolution
- // values.
- //
- {
- int $width = `getAttr defaultResolution.width`;
- int $height = `getAttr defaultResolution.height`;
- float $aspect = `getAttr defaultResolution.deviceAspectRatio`;
- int $resItem;
- int $whichRes = 1; // use "Custom" if no match is found
- string $allResNodes[] = `ls -type resolution`;
-
- global string $gImageFormatData[];
- global string $gUserImageFormatData[];
- int $numResolutionPresets = size($gImageFormatData);
- int $numUserResolutionPresets = size($gUserImageFormatData);
- int $numResolutionNodePresets = size($allResNodes) - 1;
- int $resWidth;
- int $resHeight;
- float $resAspect;
- int $numTokens;
- string $tokens[];
-
- for ($resItem = 0; $resItem < $numResolutionPresets; $resItem++) {
- string $item = $gImageFormatData[$resItem];
- $numTokens = tokenize($item, $tokens);
- if ($numTokens == 4) {
- $resWidth = $tokens[1];
- $resHeight = $tokens[2];
- $resAspect = $tokens[3];
- if ($width == $resWidth && $height == $resHeight
- && abs($aspect - $resAspect) < 0.001) {
- // We add _2_ to $resItem below: 1 because we're
- // skipping the first item (Custom) in the list, and 1
- // because the optionMenu items are numbered starting at 1,
- // but our list in $gImageFormatData is indexed starting at 0.
- $whichRes = $resItem + 2;
- break;
- }
- } else {
- string $badFormatMsg
- = ("Found invalid image format description: \""
- + $item + "\" in imageFormats.mel");
- warning $badFormatMsg;
- }
- }
-
- // If no match was found in the built-in resolutions,
- // check out the user-defined ones
- //
- if ($whichRes == 1) {
- for ($resItem = 0; $resItem < $numUserResolutionPresets; $resItem++) {
- string $item = $gUserImageFormatData[$resItem];
- $numTokens = tokenize($item, $tokens);
- if ($numTokens == 4) {
- $resWidth = $tokens[1];
- $resHeight = $tokens[2];
- $resAspect = $tokens[3];
- if ($width == $resWidth && $height == $resHeight
- && abs($aspect - $resAspect) < 0.001) {
- $whichRes = $numResolutionPresets + $resItem + 2;
- break;
- }
- } else {
- string $badFormatMsg
- = ("Found invalid image format description: \""
- + $item + "\" in userImageFormats.mel");
- warning $badFormatMsg;
- }
- }
- }
-
- // If no match was found in the user-defined resolutions,
- // see if there are any 'extra' resolution nodes in the scene.
- //
- if ($whichRes == 1) {
- for ($resItem = 0; $resItem < $numResolutionNodePresets; $resItem++) {
- //
- // We assume the 0th item in the list of resolution nodes is
- // the default one, which is created implicitly...
- string $resNodeName = $allResNodes[$resItem + 1];
-
- $resWidth = `getAttr ($resNodeName + ".width")`;
- $resHeight = `getAttr ($resNodeName + ".height")`;
- $resAspect = `getAttr ($resNodeName + ".deviceAspectRatio")`;
- if ($width == $resWidth && $height == $resHeight
- && abs($aspect - $resAspect) < 0.001) {
- // We add _2_ to $resItem below: 1 because we're
- // skipping the first item (Custom) in the list, and 1
- // because the optionMenu items are numbered starting at 1,
- // but our list in $gImageFormatData is indexed starting at 0.
- $whichRes = $numResolutionPresets
- + $numUserResolutionPresets + $resItem + 2;
- break;
- }
- }
- }
- optionMenuGrp -edit -sl $whichRes resolutionMenu;
-
- checkBoxGrp -edit -v1 `getAttr defaultResolution.aspectLock` aspectLockCheck;
- intFieldGrp -edit -v1 $width resWidth;
- intFieldGrp -edit -v1 $height resHeight;
- floatFieldGrp -edit -v1 $aspect resRatio;
- rgAdjustPixelAspect "defaultResolution";
- checkBoxGrp -edit -v1 `getAttr defaultResolution.lockDeviceAspectRatio` ratioLockCheck;
- }
-
- global proc updateRaytraceQuality ()
- //
- // Procedure Name:
- // updateRaytraceQuality
- //
- // Description:
- // Gets the real values from the nodes and sets the UI based
- // on these values. This procedure updates all of the quality
- // values.
- //
- {
- string $rendQual[] = `listConnections defaultRenderGlobals.qual`;
- int $useRT = `getAttr ($rendQual[0] + ".enableRaytracing")`;
- checkBoxGrp -edit -v1 $useRT raytraceCheck;
-
- intSliderGrp -edit -v `getAttr ($rendQual[0] + ".reflections")`
- reflectionsField;
-
- intSliderGrp -edit -v `getAttr ($rendQual[0] + ".refractions")`
- refractionsField;
-
- intSliderGrp -edit -v `getAttr ($rendQual[0] + ".shadows")`
- shadowsField;
-
- floatSliderGrp -edit -v `getAttr ($rendQual[0] + ".rayTraceBias")`
- rayTraceBiasField;
-
- intSliderGrp -edit -enable $useRT reflectionsField;
- intSliderGrp -edit -enable $useRT refractionsField;
- intSliderGrp -edit -enable $useRT shadowsField;
- floatSliderGrp -edit -enable $useRT rayTraceBiasField;
- }
-
- global proc updateRenderQuality ()
- //
- // Procedure Name:
- // updateRenderQuality
- //
- // Description:
- // Gets the real values from the nodes and sets the UI based
- // on these values. This procedure updates all of the quality
- // values.
- //
- {
- if (!`columnLayout -exists rgQualityLayout`) {
- return;
- }
-
- string $rendQual[] = `listConnections defaultRenderGlobals.qual`;
-
- int $useBlur = `getAttr defaultRenderGlobals.motionBlur`;
- int $blur2d = (`getAttr defaultRenderGlobals.motionBlurType` == 0);
- int $enableMultiPixelFilter = false;
- int $enableFilterAttrs = false;
-
- int $shadingSamples = `getAttr ($rendQual[0] + ".shadingSamples")`;
- intSliderGrp -edit -v $shadingSamples shadingSamplesField;
-
- int $maxShadingSamples = `getAttr ($rendQual[0] + ".maxShadingSamples")`;
- intSliderGrp -edit -v $maxShadingSamples maxShadingSamplesField;
-
- int $visibilitySamples = `getAttr ($rendQual[0] + ".visibilitySamples")`;
- intSliderGrp -edit -v $visibilitySamples visSamplesField;
-
- int $maxVisibilitySamples
- = `getAttr ($rendQual[0] + ".maxVisibilitySamples")`;
- intSliderGrp -edit -v $maxVisibilitySamples maxVisSamplesField;
-
- int $particleSamples = `getAttr ($rendQual[0] + ".particleSamples")`;
- intSliderGrp -edit -v $particleSamples particlesSamplesField;
-
- //
- // The edge AA settings go from 0-3 for Highest down to Low
- // But we choose to display the menu items in _ascending_ order,
- // for consistency with the order of presets.
- // Thus we must remap the values here
- //
- int $edgeAA = `getAttr ($rendQual[0] + ".edgeAntiAliasing")`;
- int $edgeMenuItem;
- if ($edgeAA == 0) { // Highest
- $edgeMenuItem = 4;
- } else if ($edgeAA == 1) { // High
- $edgeMenuItem = 3;
- } else if ($edgeAA == 2) { // Medium
- $edgeMenuItem = 2;
- } else if ($edgeAA == 3) { // Low
- $edgeMenuItem = 1;
- }
- optionMenuGrp -edit -sl $edgeMenuItem edgeMenu;
-
- int $useMultiPixelFilter
- = `getAttr ($rendQual[0] + ".useMultiPixelFilter")`;
- checkBoxGrp -edit -v1 $useMultiPixelFilter pixelCheck;
-
-
- //
- // Check against the contrast threshold values. The below
- // tolerance check is due to MEL's poor numerical accuracy.
- // E.g., setting a 0.4 value will not result in a 0.4 setting.
- //
- float $numerialTol = 0.001;
- float $highContrastRed = 0.4;
- float $highContrastGreen = 0.3;
- float $highContrastBlue = 0.6;
- float $lowContrastRed = 0.2;
- float $lowContrastGreen = 0.15;
- float $lowContrastBlue = 0.3;
-
- float $redTol = `getAttr ($rendQual[0] + ".redThreshold")`;
- float $greenTol = `getAttr ($rendQual[0] + ".greenThreshold")`;
- float $blueTol = `getAttr ($rendQual[0] + ".blueThreshold")`;
-
- float $redDiff = $redTol - $highContrastRed;
- float $greenDiff = $greenTol - $highContrastGreen;
- float $blueDiff = $blueTol - $highContrastBlue;
- int $highContrast = $redDiff < $numerialTol && $redDiff > -$numerialTol &&
- $greenDiff < $numerialTol && $greenDiff > -$numerialTol &&
- $blueDiff < $numerialTol && $blueDiff > -$numerialTol;
-
- $redDiff = $redTol - $lowContrastRed;
- $greenDiff = $greenTol - $lowContrastGreen;
- $blueDiff = $blueTol - $lowContrastBlue;
- int $lowContrast = $redDiff < $numerialTol && $redDiff > -$numerialTol &&
- $greenDiff < $numerialTol && $greenDiff > -$numerialTol &&
- $blueDiff < $numerialTol && $blueDiff > -$numerialTol;
-
-
- //
- // See if the current settings of the 6 attributes we just queried
- // match any preset settings, and set the Presets menu state
- // accordingly
- //
- if ($shadingSamples == 1 && $maxShadingSamples == 1
- && $visibilitySamples == 1 && $maxVisibilitySamples == 4
- && $edgeAA == 3 && $useMultiPixelFilter == 0 && $highContrast) {
- optionMenuGrp -edit -sl 2 qualityPresetMenu; // Preview Quality
- } else if ($shadingSamples == 1 && $maxShadingSamples == 8
- && $visibilitySamples == 1 && $maxVisibilitySamples == 4
- && $edgeAA == 0 && $useMultiPixelFilter == 0 && $highContrast) {
- optionMenuGrp -edit -sl 3 qualityPresetMenu; // Intermediate Quality
- } else if ($shadingSamples == 2 && $maxShadingSamples == 8
- && $visibilitySamples == 1 && $maxVisibilitySamples == 4
- && $edgeAA == 0 && $useMultiPixelFilter == 1 && $highContrast) {
- optionMenuGrp -edit -sl 4 qualityPresetMenu; // Production Quality
- } else if ($shadingSamples == 2 && $maxShadingSamples == 8
- && $visibilitySamples == 1 && $maxVisibilitySamples == 4
- && $edgeAA == 0 && $useMultiPixelFilter == 1 && $lowContrast) {
- optionMenuGrp -edit -sl 5 qualityPresetMenu; // Contrast Sensitive Production Quality
- } else if ($shadingSamples == 3 && $maxShadingSamples == 8
- && $visibilitySamples == 1 && $maxVisibilitySamples == 4
- && $edgeAA == 0 && $useMultiPixelFilter == 1 && $highContrast) {
- optionMenuGrp -edit -sl 6 qualityPresetMenu; // Motion Blur Production
- } else {
- optionMenuGrp -edit -sl 1 qualityPresetMenu; // custom
- }
-
- int $filterType = `getAttr ($rendQual[0] + ".pixelFilterType")`;
- if ($filterType == 0) { // Box Filter
- optionMenuGrp -edit -sl 1 pixelFilterMenu;
- } else if ($filterType == 2) { // Triangle Filter
- optionMenuGrp -edit -sl 2 pixelFilterMenu;
- } else if ($filterType == 4) { // Gaussian Filter
- optionMenuGrp -edit -sl 3 pixelFilterMenu;
- } else if ($filterType == 5) { // Quadratic B-Spline Filter
- optionMenuGrp -edit -sl 4 pixelFilterMenu;
- } else if ($filterType == 1000) { // Plug-in Filter
- optionMenuGrp -edit -sl 5 pixelFilterMenu;
- }
-
- floatSliderGrp -edit -v `getAttr ($rendQual[0] + ".pixelFilterWidthX")`
- filterXField;
-
- floatSliderGrp -edit -v `getAttr ($rendQual[0] + ".pixelFilterWidthY")`
- filterYField;
-
- floatSliderGrp -edit -v `getAttr ($rendQual[0] + ".redThreshold")`
- contrastRedField;
-
- floatSliderGrp -edit -v `getAttr ($rendQual[0] + ".greenThreshold")`
- contrastGreenField;
-
- floatSliderGrp -edit -v `getAttr ($rendQual[0] + ".blueThreshold")`
- contrastBlueField;
-
- floatSliderGrp -edit -v `getAttr ($rendQual[0] + ".coverageThreshold")`
- -enable ($useBlur && !$blur2d) contrastCoverField;
-
- optionMenuGrp -edit -enable $useMultiPixelFilter pixelFilterMenu;
- floatSliderGrp -edit -enable $useMultiPixelFilter filterXField;
- floatSliderGrp -edit -enable $useMultiPixelFilter filterYField;
-
- // Now dim out items that are not applicable,
- // based on the current settings
-
- if ($edgeAA == 3) { // Low
- checkBoxGrp -edit -enable false pixelCheck;
- optionMenuGrp -edit -enable false pixelFilterMenu;
- floatSliderGrp -edit -enable false filterXField;
- floatSliderGrp -edit -enable false filterYField;
- floatSliderGrp -edit -enable false contrastRedField;
- floatSliderGrp -edit -enable false contrastGreenField;
- floatSliderGrp -edit -enable false contrastBlueField;
- intSliderGrp -edit -enable false maxShadingSamplesField;
- intSliderGrp -edit -enable ($useBlur && !$blur2d) visSamplesField;
- intSliderGrp -edit -enable false maxVisSamplesField;
- } else if ($edgeAA == 2) { // Medium
- checkBoxGrp -edit -enable false pixelCheck;
- optionMenuGrp -edit -enable false pixelFilterMenu;
- floatSliderGrp -edit -enable false filterXField;
- floatSliderGrp -edit -enable false filterYField;
- floatSliderGrp -edit -enable false contrastRedField;
- floatSliderGrp -edit -enable false contrastGreenField;
- floatSliderGrp -edit -enable false contrastBlueField;
- intSliderGrp -edit -enable false maxShadingSamplesField;
- intSliderGrp -edit -enable ($useBlur && !$blur2d) visSamplesField;
- intSliderGrp -edit -enable false maxVisSamplesField;
- } else if ($edgeAA == 1) { // High
- $enableMultiPixelFilter = true;
- floatSliderGrp -edit -enable false contrastRedField;
- floatSliderGrp -edit -enable false contrastGreenField;
- floatSliderGrp -edit -enable false contrastBlueField;
- intSliderGrp -edit -enable false maxShadingSamplesField;
- intSliderGrp -edit -enable ($useBlur && !$blur2d) visSamplesField;
- intSliderGrp -edit -enable false maxVisSamplesField;
- } else if ($edgeAA == 0) { // Highest
- $enableMultiPixelFilter = true;
- floatSliderGrp -edit -enable true contrastRedField;
- floatSliderGrp -edit -enable true contrastGreenField;
- floatSliderGrp -edit -enable true contrastBlueField;
- intSliderGrp -edit -enable true maxShadingSamplesField;
- intSliderGrp -edit -enable ($useBlur && !$blur2d) visSamplesField;
- intSliderGrp -edit -enable ($useBlur && !$blur2d) maxVisSamplesField;
- }
- if ($enableMultiPixelFilter) {
- $enableFilterAttrs = `getAttr ($rendQual[0] + ".useMultiPixelFilter")`;
- }
- checkBoxGrp -edit -enable $enableMultiPixelFilter pixelCheck;
- optionMenuGrp -edit -enable $enableFilterAttrs pixelFilterMenu;
- floatSliderGrp -edit -enable $enableFilterAttrs filterXField;
- floatSliderGrp -edit -enable $enableFilterAttrs filterYField;
- }
-
- global proc updateMotionBlur ()
- //
- // Procedure Name:
- // updateMotionBlur
- //
- // Description:
- // Gets the real values from the nodes and sets the UI based
- // on these values. This procedure updates all of the motion
- // blur values.
- //
- {
- int $useBlur = `getAttr defaultRenderGlobals.motionBlur`;
- checkBoxGrp -edit -v1 $useBlur blurCheck;
-
- int $blur2d = (`getAttr defaultRenderGlobals.motionBlurType` == 0);
- if ($blur2d) {
- radioButtonGrp -edit -select 1 blurButton1;
- } else {
- radioButtonGrp -edit -select 1 blurButton2;
- }
-
- radioButtonGrp -edit -enable $useBlur blurButton1;
- radioButtonGrp -edit -enable $useBlur blurButton2;
-
- int $keepMotionVector = (`getAttr defaultRenderGlobals.keepMotionVector` == 1);
- if ($useBlur && $blur2d && $keepMotionVector) {
- global string $imgExt[]; // This is the actual file extension
- global int $imgExtNum[]; // This is the corresponding internal value
-
- string $imageFormatExt = "";
-
- int $imageFormatNum = `getAttr defaultRenderGlobals.imageFormat`;
-
- // Get the corresponding imgExt for this imageFormat.
-
- for ($i = 0; $i < size($imgExtNum); $i += 1) {
- if ($imageFormatNum == $imgExtNum[$i]) {
- $imageFormatExt = $imgExt[$i];
- break;
- }
- }
-
- // Check if the image format is not IFF.
- //
- // Note: there are two IFF image types. One for 8 bit images
- // and one for 16 bit images. They both have an imgExt of iff.
-
- if ($imageFormatExt != "iff" ) {
- warning
- ("Non-IFF image formats are not supported when writing"+
- " 2D motion vectors; setting image format to IFF");
-
- // Set globals imageFormat to Maya IFF
- setAttr defaultRenderGlobals.imageFormat 7;
- }
- }
-
- floatFieldGrp -edit
- -v1 `getAttr defaultRenderGlobals.motionBlurByFrame`
- -enable $useBlur
- blurFrameField;
-
- floatSliderGrp -edit
- -v `getAttr defaultRenderGlobals.blurLength`
- -enable ($useBlur && $blur2d)
- blurLengthField;
-
- floatSliderGrp -edit
- -v `getAttr defaultRenderGlobals.blurSharpness`
- -enable ($useBlur && $blur2d)
- blurSharpField;
-
- intFieldGrp -edit
- -v1 `getAttr defaultRenderGlobals.smoothValue`
- -enable ($useBlur && $blur2d)
- blurSmoothField;
-
- int $smoothColor = `getAttr defaultRenderGlobals.smoothColor`;
- radioButtonGrp -edit
- -enable ($useBlur && $blur2d)
- -select ($smoothColor + 1)
- blurSmoothRadio;
-
- checkBoxGrp -edit
- -v1 `getAttr defaultRenderGlobals.keepMotionVector`
- -enable ($useBlur && $blur2d)
- blurVectorCheck;
-
- int $useMemoryCap = `getAttr defaultRenderGlobals.useBlur2DMemoryCap`;
- checkBoxGrp -edit
- -v1 $useMemoryCap
- -enable ($useBlur && $blur2d)
- blurMemoryCapCheck;
-
- floatFieldGrp -edit
- -v1 `getAttr defaultRenderGlobals.blur2DMemoryCap`
- -enable ($useBlur && $blur2d && $useMemoryCap)
- blurMemoryCapField;
-
- }
-
- global proc createMotionBlur (string $parent)
- //
- // Procedure Name:
- // createMotionBlur
- //
- // Description:
- // Creates the UI in the "Motion Blur" expand/collapse section.
- //
- {
- setUITemplate -pushTemplate attributeEditorTemplate;
-
- setParent $parent;
- string $cName;
-
- // If the UI is created already then just update attribute values.
- if (`columnLayout -exists rgBlurLayout`) {
- updateMotionBlur;
- return;
- }
-
- columnLayout -adjustableColumn true rgBlurLayout;
-
- checkBoxGrp -numberOfCheckBoxes 1
- -label1 "Motion Blur"
- -cc "setAttr defaultRenderGlobals.motionBlur #1; updateMotionBlur; updateRenderQuality;"
- blurCheck;
- scriptJob -p $parent
- -ac "defaultRenderGlobals.motionBlur"
- "updateMotionBlur; updateRenderQuality;";
-
- radioButtonGrp -numberOfRadioButtons 1
- -label "Motion Blur Type"
- -label1 "2D"
- -onc "setAttr defaultRenderGlobals.motionBlurType 0"
- blurButton1;
- radioButtonGrp -numberOfRadioButtons 1
- -shareCollection blurButton1
- -label ""
- -label1 "3D"
- -onc "setAttr defaultRenderGlobals.motionBlurType 1"
- blurButton2;
- // Any time the motion blur type changes we also need to call
- // updateMotionBlur and updateRenderQuality. This is done through
- // a script job watching for an attribute change.
- scriptJob -p $parent
- -ac "defaultRenderGlobals.motionBlurType"
- "updateMotionBlur; updateRenderQuality;";
-
- $cName = `floatFieldGrp -label "Blur by Frame"
- -cc "setAttr defaultRenderGlobals.motionBlurByFrame #1"
- blurFrameField`;
- connectControl -index 2 $cName "defaultRenderGlobals.motionBlurByFrame";
-
- $cName = `floatSliderGrp -label "Blur Length"
- -fieldMaxValue 100
- -minValue 0
- -maxValue 30
- -cc "setAttr defaultRenderGlobals.blurLength #1"
- blurLengthField`;
- connectControl $cName "defaultRenderGlobals.blurLength";
-
- $cName = `floatSliderGrp -label "Blur Sharpness"
- -fieldMaxValue 100
- -minValue 0
- -maxValue 15
- -cc "setAttr defaultRenderGlobals.blurSharpness #1"
- blurSharpField`;
- connectControl $cName "defaultRenderGlobals.blurSharpness";
-
- $cName = `radioButtonGrp -label "Smooth"
- -numberOfRadioButtons 2
- -label1 "Alpha"
- -label2 "Color"
- -on1 "setAttr defaultRenderGlobals.smoothColor 0"
- -on2 "setAttr defaultRenderGlobals.smoothColor 1"
- blurSmoothRadio`;
- scriptJob -p $parent
- -ac "defaultRenderGlobals.smoothColor" "updateMotionBlur";
-
- $cName = `intFieldGrp -label "Smooth Value"
- -cc "setAttr defaultRenderGlobals.smoothValue #1"
- blurSmoothField`;
- connectControl -index 2 $cName "defaultRenderGlobals.smoothValue";
-
- $cName = `checkBoxGrp -numberOfCheckBoxes 1
- -label1 "Keep Motion Vectors"
- -cc "setAttr defaultRenderGlobals.keepMotionVector #1"
- blurVectorCheck`;
- connectControl -index 2 $cName "defaultRenderGlobals.keepMotionVector";
-
- $cName = `checkBoxGrp -numberOfCheckBoxes 1
- -label1 "Use 2d Blur Memory Limit"
- -cc "setAttr defaultRenderGlobals.useBlur2DMemoryCap #1; updateMotionBlur"
- blurMemoryCapCheck`;
- connectControl -index 2 $cName "defaultRenderGlobals.useBlur2DMemoryCap";
-
- $cName = `floatFieldGrp -label "2d Blur Memory Limit"
- -extraLabel "MB" -cal 3 "left"
- -cc "setAttr defaultRenderGlobals.blur2DMemoryCap #1"
- blurMemoryCapField`;
- connectControl -index 2 $cName "defaultRenderGlobals.blur2DMemoryCap";
-
-
- setParent ..;
- setUITemplate -popTemplate;
-
- // Make sure the values are right
- updateMotionBlur;
- }
-
-
- global proc updateRenderOptions ()
- //
- // Procedure Name:
- // updateRenderOptions
- //
- // Description:
- // Gets the real values from the nodes and sets the UI based
- // on these values. This procedure updates all of the options
- // values.
- //
- {
-
- // How do we get the value for this?
- // textFieldButtonGrp -edit
- // fogField;
-
- string $pluginFormat = `getAttr defaultRenderGlobals.pluginFormat`;
- textFieldGrp -edit -text $pluginFormat
- plugInFormat;
-
- string $preRenderMel = `getAttr defaultRenderGlobals.preRenderMel`;
- textFieldGrp -edit -text $preRenderMel
- preRenderMel;
-
- string $postRenderMel = `getAttr defaultRenderGlobals.postRenderMel`;
- textFieldGrp -edit -text $postRenderMel
- postRenderMel;
-
- checkBoxGrp -edit
- -v1 `getAttr "defaultRenderGlobals.enableDepthMaps"`
- depthMapCheck;
-
- checkBoxGrp -edit
- -v1 `getAttr "defaultRenderGlobals.enableDefaultLight"`
- defaultLightCheck;
-
- checkBoxGrp -edit
- -v1 `getAttr "defaultRenderGlobals.ignoreFilmGate"`
- filmGateCheck;
-
- checkBoxGrp -edit
- -v1 `getAttr "defaultRenderGlobals.clipFinalShadedColor"`
- clipCheck;
-
- checkBoxGrp -edit
- -v1 `getAttr "defaultRenderGlobals.jitterFinalColor"`
- jitterColor;
-
- checkBoxGrp -edit
- -v1 `getAttr "defaultRenderGlobals.composite"`
- compCheck;
-
- if (`isTrue MayaCreatorExists`) {
- checkBoxGrp -edit
- -v1 `getAttr "defaultRenderGlobals.applyFogInPost"`
- applyFogInPostCheck;
-
- intFieldGrp -edit
- -v1 `getAttr "defaultRenderGlobals.postFogBlur"`
- postFogBlurField;
- }
-
- checkBoxGrp -edit
- -v1 `getAttr "defaultRenderGlobals.shadowsObeyLightLinking"`
- shadowLightLinkCheck;
-
- floatFieldGrp -edit
- -v1 `getAttr "defaultRenderGlobals.compositeThreshold"`
- -enable `checkBoxGrp -q -v1 compCheck`
- compValueField;
-
- floatFieldGrp -edit
- -v1 `getAttr "defaultRenderGlobals.gammaCorrection"`
- gammaField;
- }
-
-
- //==================================================================
- //
- // Starting the data changing section
- //
- //==================================================================
-
-
- global proc changeFileName ()
- //
- // Procedure Name:
- // changeFileName
- //
- // Description:
- // This procedure is called when the user changes the file
- // prefix. It sets the internal representation of the prefix
- // and then updates the example to show the changes.
- //
- {
- string $prefix = `textFieldGrp -query -text fileName`;
- if ($prefix != "(not set; using filename)"
- && validFileNamePrefix($prefix)) {
- string $globalsAttr = "defaultRenderGlobals.imageFilePrefix";
- setAttr $globalsAttr -type "string" $prefix;
- }
-
- updateImageFile;
- updateFileOutputFeedback;
- }
-
- global proc changeExtension ()
- //
- // Procedure Name:
- // changeExtension
- //
- // Description:
- // This procedure is called when the user changes the format
- // of the file extension. It sets the internal representation
- // and then updates the example to show the changes.
- //
- // Note:
- // Although the user sees only one control to change the
- // extension, it actually affects more than one value.
- //
- {
- global string $imgExt[]; // This is the actual file extension
- global int $imgExtNum[]; // This is the corresponding internal value
-
- int $item = `optionMenuGrp -q -sl extMenu`;
- int $ext = `optionMenuGrp -q -sl imageMenu` - 1;
- int $multiframe = multiframeFormat($imgExt[$ext]);
-
- // print ("changeExtension to " + $ext + " " + $imgExt[$ext] + "\nmultiframe " + $multiframe + "\n" );
- {
- //
- // "name"
- //
- if ($item == 1) {
- // Animation off
- setAttr defaultRenderGlobals.animation 0;
- // No image file format type
- setAttr defaultRenderGlobals.outFormatControl 1;
- setAttr "defaultRenderGlobals.periodInExt" 1;
- //
- // "name.ext"
- //
- } else if ($item == 2) {
- // Animation off
- setAttr defaultRenderGlobals.animation 0;
- if (`checkBoxGrp -q -v1 imageCheckBox`) {
- // Override image file format type
- setAttr defaultRenderGlobals.outFormatControl 2;
- } else {
- // Standard image file format type
- setAttr defaultRenderGlobals.outFormatControl 0;
- }
- setAttr "defaultRenderGlobals.periodInExt" 1;
- //
- // "name.#.ext"
- //
- } else if ($item == 3) {
- // Animation on
- setAttr defaultRenderGlobals.animation 1;
- if (`checkBoxGrp -q -v1 imageCheckBox`) {
- // Override image file format type
- setAttr defaultRenderGlobals.outFormatControl 2;
- } else {
- // Standard image file format type
- setAttr defaultRenderGlobals.outFormatControl 0;
- }
- setAttr "defaultRenderGlobals.putFrameBeforeExt" 1;
- setAttr "defaultRenderGlobals.periodInExt" 1;
- //
- // "name.ext.#"
- //
- } else if ($item == 4) {
- // Animation on
- setAttr defaultRenderGlobals.animation 1;
- if (`checkBoxGrp -q -v1 imageCheckBox`) {
- // Override image file format type
- setAttr defaultRenderGlobals.outFormatControl 2;
- } else {
- // Standard image file format type
- setAttr defaultRenderGlobals.outFormatControl 0;
- }
- setAttr "defaultRenderGlobals.putFrameBeforeExt" 0;
- setAttr "defaultRenderGlobals.periodInExt" 1;
- //
- // "name.#"
- //
- } else if ($item == 5) {
- // Animation on
- setAttr defaultRenderGlobals.animation 1;
- // No image file format type
- setAttr defaultRenderGlobals.outFormatControl 1;
- setAttr "defaultRenderGlobals.periodInExt" 1;
- //
- // "name#.ext"
- //
- } else if ($item == 6) {
- // Animation on
- setAttr defaultRenderGlobals.animation 1;
- if (`checkBoxGrp -q -v1 imageCheckBox`) {
- // Override image file format type
- setAttr defaultRenderGlobals.outFormatControl 2;
- } else {
- // Standard image file format type
- setAttr defaultRenderGlobals.outFormatControl 0;
- }
- setAttr "defaultRenderGlobals.putFrameBeforeExt" 1;
- setAttr "defaultRenderGlobals.periodInExt" 0;
- }
- }
-
- updateFrames;
- updateExtOptions;
- updateFileOutputFeedback;
-
- // Also update the main render window if it exists.
- if (`exists updateMainRenderMenu`) {
- updateMainRenderMenu();
- }
- // And the batch render window
- if (`exists updateBatchRenderWindowTitle`) {
- updateBatchRenderWindowTitle();
- }
- }
-
- global proc changeImageFormat ()
- //
- // Procedure Name:
- // changeImageFormat
- //
- // Description:
- // This procedure is called when the user changes the type of
- // image that will be written out. It sets the internal
- // representation and then updates the example to show the changes.
- //
- {
- global string $imgExt[]; // This is the actual file extension
- global int $imgExtNum[]; // This is the corresponding internal value
-
- int $item = `optionMenuGrp -q -sl imageMenu` - 1;
- setAttr defaultRenderGlobals.imageFormat $imgExtNum[$item];
- updateFileOutputFeedback;
-
- // Check if the image format is IFF.
- //
- // Note: there are two IFF image types. One for 8 bit images
- // and one for 16 bit images. They both have an imgExt of iff.
-
- if ($imgExt[$item] != "iff") {
- int $useBlur = `getAttr defaultRenderGlobals.motionBlur`;
- int $blur2d = (`getAttr defaultRenderGlobals.motionBlurType` == 0);
- int $keepMotionVector = (`getAttr defaultRenderGlobals.keepMotionVector` == 1);
- if ($useBlur && $blur2d && $keepMotionVector) {
- warning
- ("Non-IFF image formats are not supported when writing"+
- " 2D motion vectors; setting image format to IFF");
-
- // Set globals imageFormat to Maya IFF
- setAttr defaultRenderGlobals.imageFormat 7;
- }
- }
-
- $item = `optionMenuGrp -q -sl imageMenu` - 1;
- int $multiframe = multiframeFormat($imgExt[$item]);
-
- if ( $multiframe )
- {
- setAttr defaultRenderGlobals.animation 1;
- }
-
- updateFrames;
- updateExtOptions;
- updateFileOutputFeedback;
-
- // Also update the main render window if it exists.
- if (`exists updateMainRenderMenu`) {
- updateMainRenderMenu();
- }
- // And the batch render window
- if (`exists updateBatchRenderWindowTitle`) {
- updateBatchRenderWindowTitle();
- }
- }
-
- global proc changeRenderObj ()
- //
- // Procedure Name:
- // changeRenderObj
- //
- // Description:
- // This procedure is called when the user changes the rendered
- // objects. It sets the internal representation.
- //
- {
- int $item = `optionMenuGrp -q -sl renderObjMenu`;
- if ($item == 1)
- setAttr defaultRenderGlobals.renderAll 1;
- else
- setAttr defaultRenderGlobals.renderAll 0;
- }
-
- global proc updateCameraAttrs ()
- //
- // Procedure Name:
- // updateCameraAttrs
- //
- // Description:
- // This procedure is called when the user changes attributes affecting
- // a camera. It updates the corresponding attributes on the camera.
- //
- {
- int $camIndex = `optionMenuGrp -q -sl cameraMenu` - 1;
- string $allCameras[] = `ls -ca`;
- string $whichCamera = $allCameras[$camIndex];
- setAttr ($whichCamera + ".image") `checkBoxGrp -q -v1 rgbChannel`;
- setAttr ($whichCamera + ".mask") `checkBoxGrp -q -v1 alphaChannel`;
- setAttr ($whichCamera + ".depth") `checkBoxGrp -q -v1 depthChannel`;
- }
-
- global proc switchCamera ()
- //
- // Procedure Name:
- // switchCamera
- //
- // Description:
- // This procedure is called when the user changes the camera
- // that will be rendered.
- // It updates the controls for the new camera
- //
- {
- //
- // First count how many renderable cameras exist
- //
- string $allCameras[] = `ls -ca`;
- int $numRenderable = 0;
- for ($i = 0; $i < size($allCameras); $i++) {
- if (`getAttr ($allCameras[$i] + ".renderable")`) {
- $numRenderable++;
- }
- }
- int $camIndex = `optionMenuGrp -q -sl cameraMenu` - 1;
- if ($numRenderable < 2) {
- for ($i = 0; $i < size($allCameras); $i++) {
- if ($i == $camIndex) {
- setAttr ($allCameras[$i] + ".renderable") 1;
- } else {
- setAttr ($allCameras[$i] + ".renderable") 0;
- }
- }
- }
-
- string $whichCamera = $allCameras[$camIndex];
- checkBoxGrp -edit -v1 `getAttr ($whichCamera + ".image")` rgbChannel;
- checkBoxGrp -edit -v1 `getAttr ($whichCamera + ".mask")` alphaChannel;
- checkBoxGrp -edit -v1 `getAttr ($whichCamera + ".depth")` depthChannel;
- updateFileOutputFeedback;
-
- // Fix for 160069. The mental ray renderer and the Maya renderer
- // use the same renderable camera, so the mental ray render globals and
- // the Maya render globals must be kept in sync when the renderable camera
- // changes. The following code causes the attribute editor to be
- // refreshed, just in case it contains the mental ray render globals.
- //
- global string $gAEFocusNode;
- updateAE($gAEFocusNode);
- }
-
- global proc changeCustomExtensionCheck ()
- //
- // Procedure Name:
- // changeCustomExtensionCheck
- //
- // Description:
- // This procedure is called when the user turns the custom
- // extension on or off. It sets the internal representation
- // and then updates the example to show the changes.
- //
- {
- int $isOn = `checkBoxGrp -q -v1 imageCheckBox`;
- if ($isOn) {
- setAttr defaultRenderGlobals.outFormatControl 2;
- } else {
- // We have to figure out if there should be an extension
- // at all or not.
- int $item = `optionMenuGrp -q -sl extMenu`;
- if ($item == 1 || $item == 5) {
- setAttr defaultRenderGlobals.outFormatControl 1;
- } else {
- setAttr defaultRenderGlobals.outFormatControl 0;
- }
- }
-
- updateExtOptions;
- updateFileOutputFeedback;
- }
-
- global proc changeCustomExtensionName ()
- //
- // Procedure Name:
- // changeCustomExtensionName
- //
- // Description:
- // This procedure is called when the user specifies a custom
- // extension. It sets the internal representation
- // and then updates the example to show the changes.
- //
- {
- setAttr -type "string" "defaultRenderGlobals.outFormatExt" `textFieldGrp -q -text userExt`;
- updateExtOptions;
- updateFileOutputFeedback;
- }
-
- global proc changeFrameExtension ()
- //
- // Procedure Name:
- // changeFrameExtension
- //
- // Description:
- // This procedure is called when the user overrides the
- // frame numbers with new output numbers. It sets the internal
- // representation and then updates the example to show the changes.
- //
- {
- int $newValue = `intFieldGrp -q -v1 frameStartOverride`;
- if ($newValue < 0) {
- $newValue = 0;
- intFieldGrp -edit -v1 $newValue frameStartOverride;
- catch (warning("Value cannot be negative."));
- }
- setAttr "defaultRenderGlobals.startExtension" $newValue;
-
- $newValue = `intFieldGrp -q -v1 frameByOverride`;
- if ($newValue < 0) {
- $newValue = 0;
- intFieldGrp -edit -v1 $newValue frameByOverride;
- catch (warning("Value cannot be negative."));
- }
- setAttr "defaultRenderGlobals.byExtension" $newValue;
-
- updateFileOutputFeedback;
- }
-
- global proc changeFieldOptions ()
- //
- // Procedure Name:
- // changeFieldOptions
- //
- // Description:
- // This procedure is called when the user changes any of the
- // values for fields. It sets the internal representation
- // and then updates the example to show the changes.
- //
- {
- // Note that we stored the fields values internally different
- // from what's presented in the menu. That is why the below
- // convoluted case statement. Sorry - see 123444.
- int $realFieldsValue = (`optionMenuGrp -q -sl fieldMenu` - 1);
- switch ($realFieldsValue) {
- case 0:
- setAttr "defaultResolution.fields" 0;
- break;
- case 1:
- case 2:
- setAttr "defaultResolution.fields" ($realFieldsValue + 2);
- break;
- case 3:
- case 4:
- setAttr "defaultResolution.fields" ($realFieldsValue - 2);
- break;
- }
-
-
- int $whichDominance = `optionMenuGrp -q -sl fieldDominanceMenu`;
- if ($whichDominance == 1) {
- setAttr "defaultResolution.oddFieldFirst" true;
- } else {
- setAttr "defaultResolution.oddFieldFirst" false;
- }
- setAttr "defaultResolution.zerothScanline"
- (`radioButtonGrp -q -sl scanlineButtons` -1);
-
- if (`radioButtonGrp -q -sl fieldButton1`) {
- setAttr "defaultRenderGlobals.fieldExtControl" 1;
- } else if (`radioButtonGrp -q -sl fieldButton2`) {
- setAttr "defaultRenderGlobals.fieldExtControl" 0;
- } else {
- setAttr "defaultRenderGlobals.fieldExtControl" 2;
- }
-
- string $test = `textFieldGrp -q -text oddFieldExt`;
- if (size($test) > 1) {
- catch (error ("Field extensions must be a single character."));
- } else {
- setAttr -type "string" "defaultRenderGlobals.oddFieldExt" $test;
- }
-
- $test = `textFieldGrp -q -text evenFieldExt`;
- if (size($test) > 1) {
- catch (error ("Field extensions must be a single character."));
- } else {
- setAttr -type "string" "defaultRenderGlobals.evenFieldExt" $test;
- }
-
- updateFieldOptions;
- updateFileOutputFeedback;
- }
-
- global proc changeResolution ()
- //
- // Procedure Name:
- // changeResolution
- //
- // Description:
- // This procedure is called when the user selects a different
- // resolution. It sets the internal representation
- // and then updates the example to show the changes.
- //
- {
- global string $gImageFormatData[];
- global string $gUserImageFormatData[];
- int $numResolutionPresets = size($gImageFormatData);
- int $numUserResolutionPresets = size($gUserImageFormatData);
- string $allResNodes[] = `ls -type resolution`;
- int $numResolutionNodePresets = size($allResNodes) - 1;
- string $tokens[];
- int $resItem = `optionMenuGrp -q -sl resolutionMenu`;
- int $resWidth;
- int $resHeight;
- float $resAspect;
- string $item;
-
- // Item #1 is Custom, which doesn't change the fields
- // We subtract _2_ from $resItem below: 1 because we're
- // skipping the first item (Custom) in the list, and 1
- // because the optionMenu items are numbered starting at 1,
- // but our list in $gImageFormatData is indexed starting at 0.
- //
- if ($resItem > 1) {
- if ($resItem > ($numResolutionPresets + 1)) {
- if ($resItem
- > ($numResolutionPresets + $numUserResolutionPresets + 1)) {
- // It's one of the user-defined resolution nodes' presets
- string $resNodeName = $allResNodes[$resItem
- - $numResolutionPresets
- - $numUserResolutionPresets
- - 1];
- $resWidth = `getAttr ($resNodeName + ".width")`;
- $resHeight = `getAttr ($resNodeName + ".height")`;
- $resAspect = `getAttr ($resNodeName + ".deviceAspectRatio")`;
- } else {
- // It's one of the user-defined resolution presets
- $item = $gUserImageFormatData[$resItem
- - $numResolutionPresets - 2];
- int $numTokens = tokenize($item, $tokens);
- $resWidth = $tokens[1];
- $resHeight = $tokens[2];
- $resAspect = $tokens[3];
- }
- } else {
- // It's one of the built-in resolution presets
- $item = $gImageFormatData[$resItem - 2];
- int $numTokens = tokenize($item, $tokens);
- $resWidth = $tokens[1];
- $resHeight = $tokens[2];
- $resAspect = $tokens[3];
- }
- setAttr "defaultResolution.width" $resWidth;
- setAttr "defaultResolution.height" $resHeight;
- setAttr "defaultResolution.deviceAspectRatio" $resAspect;
- setAttr "defaultResolution.lockDeviceAspectRatio" 1;
-
- // Set the proper field ordering if PAL or NTSC.
- if (`getAttr defaultResolution.height` == 576) { // PAL
- setAttr "defaultResolution.oddFieldFirst" 0;
- if (`columnLayout -exists rgFieldLayout`) updateFieldOptions();
- } else if (`getAttr defaultResolution.height` == 486) { // NTSC
- setAttr "defaultResolution.oddFieldFirst" 1;
- if (`columnLayout -exists rgFieldLayout`) updateFieldOptions();
- }
- }
-
- updateResolution;
- }
-
- global proc changeAspectLockWidth ()
- //
- // Procedure Name:
- // changeAspectLockWidth
- //
- // Description:
- // This procedure is called when the user changes the
- // resolution width. It sets the internal representation
- // then looks at the ratio lock etc and changes any other
- // values that rely on it.
- //
- {
- int $requestedWidth = `intFieldGrp -q -v1 resWidth`;
- int $isMayaEvalVersion = `about -ev`;
- int $kPLEMaxX = 1024;
- int $kPLEMaxY = 768;
- if ( $isMayaEvalVersion ) {
- if( $requestedWidth > $kPLEMaxX ) {
- warning( "Image resolution is limited to "+$kPLEMaxX+"x"+$kPLEMaxY+" pixels for the Maya Personal Learning Edition" );
- $requestedWidth = $kPLEMaxX;
- }
- if( `getAttr defaultResolution.aspectLock` ) {
- float $aspect = `getAttr defaultResolution.pixelAspect`;
- if ( $aspect > 0.0 ){
- int $rez = $aspect * $requestedWidth;
- int $oldrez = `getAttr defaultResolution.height`;
- if ($rez <= $kPLEMaxY) {
- if ($rez - $oldrez > 1 || $oldrez - $rez > 1) {
- setAttr defaultResolution.height $rez;
- }
- } else {
- intFieldGrp -e -v1 $kPLEMaxY resHeight;
- changeAspectLockHeight;
- return;
- }
- }
- }
- }
-
- if ($requestedWidth < 2) {
- warning "Width must be at least 2 pixels";
- $requestedWidth = 2;
- }
-
- setAttr defaultResolution.width $requestedWidth;
- optionMenuGrp -edit -sl 1 resolutionMenu;
- checkAspectLockWidth "defaultResolution";
-
- // Update the values
- updateResolution;
- }
-
- global proc changeAspectLockHeight ()
- //
- // Procedure Name:
- // changeAspectLockHeight
- //
- // Description:
- // This procedure is called when the user changes the
- // resolution width. It sets the internal representation
- // then looks at the ratio lock etc and changes any other
- // values that rely on it.
- //
- {
- int $requestedHeight = `intFieldGrp -q -v1 resHeight`;
- int $isMayaEvalVersion = `about -ev`;
- int $kPLEMaxX = 1024;
- int $kPLEMaxY = 768;
- if ( $isMayaEvalVersion ) {
- if( $requestedHeight > $kPLEMaxY ) {
- warning( "Image resolution is limited to "+$kPLEMaxX+"x"+$kPLEMaxY+" pixels for the Maya Personal Learning Edition" );
- $requestedHeight = $kPLEMaxY;
- }
- if( `getAttr defaultResolution.aspectLock` ) {
- float $aspect = `getAttr defaultResolution.pixelAspect`;
- if ( $aspect > 0.0 ){
- int $rez = $requestedHeight / $aspect;
- int $oldrez = `getAttr defaultResolution.width`;
- if ($rez <= $kPLEMaxX) {
- if ($rez - $oldrez > 1 || $oldrez - $rez > 1) {
- setAttr defaultResolution.width $rez;
- }
- } else {
- intFieldGrp -e -v1 $kPLEMaxX resWidth;
- changeAspectLockWidth;
- return;
- }
- }
- }
- }
-
- if ($requestedHeight < 2) {
- warning "Height must be at least 2 pixels";
- $requestedHeight = 2;
- }
-
- setAttr defaultResolution.height $requestedHeight;
- optionMenuGrp -edit -sl 1 resolutionMenu;
- checkAspectLockHeight "defaultResolution";
-
- // Set the proper field ordering if PAL or NTSC.
- if (`getAttr defaultResolution.height` == 576) { // PAL
- setAttr "defaultResolution.oddFieldFirst" 0;
- if (`columnLayout -exists rgFieldLayout`) updateFieldOptions();
- } else if (`getAttr defaultResolution.height` == 486) { // NTSC
- setAttr "defaultResolution.oddFieldFirst" 1;
- if (`columnLayout -exists rgFieldLayout`) updateFieldOptions();
- }
-
- // Update the values
- updateResolution;
- }
-
- //==================================================================
- //
- // Starting the UI creation section
- //
- //==================================================================
-
- global proc createImageFile (string $parent)
- //
- // Procedure Name:
- // createImageFile
- //
- // Description:
- // Creates the UI in the "Image File Output" expand/collapse section.
- // This section is always created so is treated differently
- // then the sections created when the tab is expanded.
- //
- {
- setUITemplate -pushTemplate attributeEditorTemplate;
-
- setParent $parent;
- string $cName;
-
- columnLayout -adjustableColumn true;
-
- textFieldGrp -label "File Name Prefix" -cc changeFileName fileName;
-
- // Extension ------------------------------------------------
-
- optionMenuGrp -label "Frame/Animation Ext" -cc changeExtension extMenu;
- menuItem -label "name (Single Frame)";
- menuItem -label "name.ext (Single Frame)";
- menuItem -label "name.#.ext";
- menuItem -label "name.ext.#";
- menuItem -label "name.#";
- menuItem -label "name#.ext";
-
- // Frames numbers ------------------------------------------------
-
- floatFieldGrp -numberOfFields 1
- -label "Start Frame"
- -cc "setAttr defaultRenderGlobals.startFrame `floatFieldGrp -q -v1 startFrame`; updateFileOutputFeedback"
- startFrame;
- scriptJob -p $parent
- -ac "defaultRenderGlobals.startFrame"
- "updateFrames; updateFileOutputFeedback;";
-
- floatFieldGrp -numberOfFields 1
- -label "End Frame"
- -cc "setAttr defaultRenderGlobals.endFrame `floatFieldGrp -q -v1 endFrame`; updateFileOutputFeedback"
- endFrame;
- scriptJob -p $parent
- -ac "defaultRenderGlobals.endFrame"
- "updateFrames; updateFileOutputFeedback;";
-
- floatFieldGrp -numberOfFields 1
- -label "By Frame"
- -cc "setAttr defaultRenderGlobals.byFrameStep `floatFieldGrp -q -v1 frameStep`"
- frameStep;
- scriptJob -p $parent
- -ac "defaultRenderGlobals.byFrameStep"
- "updateFrames; updateFileOutputFeedback;";
-
- intFieldGrp -numberOfFields 1
- -label "Frame Padding"
- -cc "setAttr defaultRenderGlobals.extensionPadding `intFieldGrp -q -v1 extPad`; updateFileOutputFeedback"
- extPad;
- scriptJob -p $parent
- -ac "defaultRenderGlobals.extensionPadding"
- "updateFrames; updateFileOutputFeedback;";
-
- // Image Format ------------------------------------------------
-
- // These tables translate between the internal representation of the
- // image formats and the UI that is presented to the user.
- //
-
- // Fill up the above tables alphabetically.
- // NOTE !!!! WARNING !!!! NOTE !!!! WARNING !!!! NOTE !!!! WARNING !!!!
- // If you are changing one of the menuItem fields below or adding new ones or
- // whatever, be certain to also update the fields in the 'createImageFormats()'
- // procedure of createImageFormats.mel
-
- global string $imgExt[];
-
- if (size( $imgExt ) == 0) {
- // If the file format array has not been initialized yet, do so.
- // This routine may be called in dynPaintMenus.mel during the
- // file save for PFX canvas images.
- createImageFormats();
- }
-
- int $isMayaEvalVersion = `about -ev`;
-
- if ( $isMayaEvalVersion ) {
-
- if (`about -nt`) {
- optionMenuGrp -label "Image Format" -cc changeImageFormat imageMenu;
- menuItem -label "Alias PIX (als)"; // $imgExt[0] = "als"; $imgExtNum[0] = 6;
- menuItem -label "AVI (avi)"; // $imgExt[1] = "avi"; $imgExtNum[1] = 23;
- menuItem -label "Cineon (cin)"; // $imgExt[2] = "cin"; $imgExtNum[2] = 11;
- menuItem -label "EPS (eps)"; // $imgExt[3] = "eps"; $imgExtNum[3] = 9;
- menuItem -label "GIF (gif)"; // $imgExt[4] = "gif"; $imgExtNum[4] = 0;
- menuItem -label "JPEG (jpeg)"; // $imgExt[5] = "jpeg"; $imgExtNum[5] = 8;
- menuItem -label "Maya IFF (iff)"; // $imgExt[6] = "iff"; $imgExtNum[6] = 7;
- menuItem -label "Quantel (yuv)"; // $imgExt[7] = "yuv"; $imgExtNum[8] = 12;
- menuItem -label "RLA (rla)"; // $imgExt[8] = "rla"; $imgExtNum[9] = 2;
- menuItem -label "SGI (sgi)"; // $imgExt[9] = "sgi"; $imgExtNum[10] = 5;
- menuItem -label "SoftImage (pic)"; // $imgExt[10] = "pic"; $imgExtNum[12] = 1;
- menuItem -label "Targa (tga)"; // $imgExt[11] = "tga"; $imgExtNum[13] = 19;
- menuItem -label "Tiff (tif)"; // $imgExt[12] = "tif"; $imgExtNum[14] = 3;
- menuItem -label "Windows Bitmap (bmp)"; // $imgExt[13] = "bmp"; $imgExtNum[16] = 20;
- } else if (`about -irix`) {
- optionMenuGrp -label "Image Format" -cc changeImageFormat imageMenu;
- menuItem -label "Alias PIX (als)"; // $imgExt[0] = "als"; $imgExtNum[0] = 6;
- menuItem -label "AVI (avi)"; // $imgExt[1] = "avi"; $imgExtNum[1] = 23;
- menuItem -label "Cineon (cin)"; // $imgExt[2] = "cin"; $imgExtNum[2] = 11;
- menuItem -label "EPS (eps)"; // $imgExt[3] = "eps"; $imgExtNum[3] = 9;
- menuItem -label "GIF (gif)"; // $imgExt[4] = "gif"; $imgExtNum[4] = 0;
- menuItem -label "JPEG (jpeg)"; // $imgExt[5] = "jpeg"; $imgExtNum[5] = 8;
- menuItem -label "Maya IFF (iff)"; // $imgExt[6] = "iff"; $imgExtNum[6] = 7;
- menuItem -label "Quantel (yuv)"; // $imgExt[7] = "yuv"; $imgExtNum[7] = 12;
- menuItem -label "Quicktime (qt)"; // $imgExt[8] = "qt"; $imgExtNum[8] = 22;
- menuItem -label "RLA (rla)"; // $imgExt[9] = "rla"; $imgExtNum[9] = 2;
- menuItem -label "SGI (sgi)"; // $imgExt[10] = "sgi"; $imgExtNum[10] = 5;
- menuItem -label "SGI Movie (mv)"; // $imgExt[11] = "mv"; $imgExtNum[11] = 21;
- menuItem -label "SoftImage (pic)"; // $imgExt[12] = "pic"; $imgExtNum[12] = 1;
- menuItem -label "Targa (tga)"; // $imgExt[13] = "tga"; $imgExtNum[13] = 19;
- menuItem -label "Tiff (tif)"; // $imgExt[14] = "tif"; $imgExtNum[14] = 3;
- menuItem -label "Windows Bitmap (bmp)"; // $imgExt[15] = "bmp"; $imgExtNum[15] = 20;
- } else if (`about -linux`) {
- optionMenuGrp -label "Image Format" -cc changeImageFormat imageMenu;
- menuItem -label "Alias PIX (als)"; // $imgExt[0] = "als"; $imgExtNum[0] = 6;
- menuItem -label "Cineon (cin)"; // $imgExt[1] = "cin"; $imgExtNum[1] = 11;
- menuItem -label "EPS (eps)"; // $imgExt[2] = "eps"; $imgExtNum[2] = 9;
- menuItem -label "GIF (gif)"; // $imgExt[3] = "gif"; $imgExtNum[3] = 0;
- menuItem -label "JPEG (jpeg)"; // $imgExt[4] = "jpeg"; $imgExtNum[4] = 8;
- menuItem -label "Maya IFF (iff)"; // $imgExt[5] = "iff"; $imgExtNum[5] = 7;
- menuItem -label "Quantel (yuv)"; // $imgExt[6] = "yuv"; $imgExtNum[6] = 12;
- menuItem -label "RLA (rla)"; // $imgExt[7] = "rla"; $imgExtNum[7] = 2;
- menuItem -label "SGI (sgi)"; // $imgExt[8] = "sgi"; $imgExtNum[8] = 5;
- menuItem -label "SoftImage (pic)"; // $imgExt[9] = "pic"; $imgExtNum[9] = 1;
- menuItem -label "Targa (tga)"; // $imgExt[10] = "tga"; $imgExtNum[10] = 19;
- menuItem -label "Tiff (tif)"; // $imgExt[11] = "tif"; $imgExtNum[11] = 3;
- menuItem -label "Windows Bitmap (bmp)"; // $imgExt[12] = "bmp"; $imgExtNum[12] = 20;
- } else if ( `about -mac` ) {
- optionMenuGrp -label "Image Format" -cc changeImageFormat imageMenu;
- menuItem -label "JPEG (jpeg)";
- menuItem -label "Maya IFF (iff)";
- menuItem -label "MacPaint (pntg)";
- menuItem -label "Photoshop (ps)";
- menuItem -label "PNG (png)";
- menuItem -label "QuickDraw (pict)";
- menuItem -label "Quicktime Movie (qt)";
- menuItem -label "Quicktime Image (qtif)";
- menuItem -label "Silicon Graphics (sgi)";
- menuItem -label "Targa (tga)";
- menuItem -label "Tiff (tif)";
- menuItem -label "Windows Bitmap (bmp)";
- } else {
- warning "Unsupported platform in renderGlobalsWindow.mel";
- }
-
- } else {
-
- if (`about -nt`) {
- optionMenuGrp -label "Image Format" -cc changeImageFormat imageMenu;
- menuItem -label "Alias PIX (als)"; // $imgExt[0] = "als"; $imgExtNum[0] = 6;
- menuItem -label "AVI (avi)"; // $imgExt[1] = "avi"; $imgExtNum[1] = 23;
- menuItem -label "Cineon (cin)"; // $imgExt[2] = "cin"; $imgExtNum[2] = 11;
- menuItem -label "EPS (eps)"; // $imgExt[3] = "eps"; $imgExtNum[3] = 9;
- menuItem -label "GIF (gif)"; // $imgExt[4] = "gif"; $imgExtNum[4] = 0;
- menuItem -label "JPEG (jpeg)"; // $imgExt[5] = "jpeg"; $imgExtNum[5] = 8;
- menuItem -label "Maya IFF (iff)"; // $imgExt[6] = "iff"; $imgExtNum[6] = 7;
- menuItem -label "Maya16 IFF (iff)"; // $imgExt[7] = "iff"; $imgExtNum[7] = 10;
- menuItem -label "Quantel (yuv)"; // $imgExt[8] = "yuv"; $imgExtNum[8] = 12;
- menuItem -label "RLA (rla)"; // $imgExt[9] = "rla"; $imgExtNum[9] = 2;
- menuItem -label "SGI (sgi)"; // $imgExt[10] = "sgi"; $imgExtNum[10] = 5;
- menuItem -label "SGI16 (sgi)"; // $imgExt[11] = "sgi"; $imgExtNum[11] = 13;
- menuItem -label "SoftImage (pic)"; // $imgExt[12] = "pic"; $imgExtNum[12] = 1;
- menuItem -label "Targa (tga)"; // $imgExt[13] = "tga"; $imgExtNum[13] = 19;
- menuItem -label "Tiff (tif)"; // $imgExt[14] = "tif"; $imgExtNum[14] = 3;
- menuItem -label "Tiff16 (tif)"; // $imgExt[15] = "tif"; $imgExtNum[15] = 4;
- menuItem -label "Windows Bitmap (bmp)"; // $imgExt[16] = "bmp"; $imgExtNum[16] = 20;
- } else if (`about -irix`) {
- optionMenuGrp -label "Image Format" -cc changeImageFormat imageMenu;
- menuItem -label "Alias PIX (als)"; // $imgExt[0] = "als"; $imgExtNum[0] = 6;
- menuItem -label "AVI (avi)"; // $imgExt[1] = "avi"; $imgExtNum[1] = 23;
- menuItem -label "Cineon (cin)"; // $imgExt[2] = "cin"; $imgExtNum[2] = 11;
- menuItem -label "EPS (eps)"; // $imgExt[3] = "eps"; $imgExtNum[3] = 9;
- menuItem -label "GIF (gif)"; // $imgExt[4] = "gif"; $imgExtNum[4] = 0;
- menuItem -label "JPEG (jpeg)"; // $imgExt[5] = "jpeg"; $imgExtNum[5] = 8;
- menuItem -label "Maya IFF (iff)"; // $imgExt[6] = "iff"; $imgExtNum[6] = 7;
- menuItem -label "Maya16 IFF (iff)"; // $imgExt[7] = "iff"; $imgExtNum[7] = 10;
- menuItem -label "Quantel (yuv)"; // $imgExt[8] = "yuv"; $imgExtNum[8] = 12;
- menuItem -label "Quicktime (qt)"; // $imgExt[9] = "qt"; $imgExtNum[9] = 22;
- menuItem -label "RLA (rla)"; // $imgExt[10] = "rla"; $imgExtNum[10] = 2;
- menuItem -label "SGI (sgi)"; // $imgExt[11] = "sgi"; $imgExtNum[11] = 5;
- menuItem -label "SGI16 (sgi)"; // $imgExt[12] = "sgi"; $imgExtNum[12] = 13;
- menuItem -label "SGI Movie (mv)"; // $imgExt[13] = "mv"; $imgExtNum[13] = 21;
- menuItem -label "SoftImage (pic)"; // $imgExt[14] = "pic"; $imgExtNum[14] = 1;
- menuItem -label "Targa (tga)"; // $imgExt[15] = "tga"; $imgExtNum[15] = 19;
- menuItem -label "Tiff (tif)"; // $imgExt[16] = "tif"; $imgExtNum[16] = 3;
- menuItem -label "Tiff16 (tif)"; // $imgExt[17] = "tif"; $imgExtNum[17] = 4;
- menuItem -label "Windows Bitmap (bmp)"; // $imgExt[18] = "bmp"; $imgExtNum[18] = 20;
- } else if (`about -linux`) {
- optionMenuGrp -label "Image Format" -cc changeImageFormat imageMenu;
- menuItem -label "Alias PIX (als)"; // $imgExt[0] = "als"; $imgExtNum[0] = 6;
- menuItem -label "Cineon (cin)"; // $imgExt[1] = "cin"; $imgExtNum[1] = 11;
- menuItem -label "EPS (eps)"; // $imgExt[2] = "eps"; $imgExtNum[2] = 9;
- menuItem -label "GIF (gif)"; // $imgExt[3] = "gif"; $imgExtNum[3] = 0;
- menuItem -label "JPEG (jpeg)"; // $imgExt[4] = "jpeg"; $imgExtNum[4] = 8;
- menuItem -label "Maya IFF (iff)"; // $imgExt[5] = "iff"; $imgExtNum[5] = 7;
- menuItem -label "Maya16 IFF (iff)"; // $imgExt[6] = "iff"; $imgExtNum[6] = 10;
- menuItem -label "Quantel (yuv)"; // $imgExt[7] = "yuv"; $imgExtNum[7] = 12;
- menuItem -label "RLA (rla)"; // $imgExt[8] = "rla"; $imgExtNum[8] = 2;
- menuItem -label "SGI (sgi)"; // $imgExt[9] = "sgi"; $imgExtNum[9] = 5;
- menuItem -label "SGI16 (sgi)"; // $imgExt[10] = "sgi"; $imgExtNum[10] = 13;
- menuItem -label "SoftImage (pic)"; // $imgExt[11] = "pic"; $imgExtNum[11] = 1;
- menuItem -label "Targa (tga)"; // $imgExt[12] = "tga"; $imgExtNum[12] = 19;
- menuItem -label "Tiff (tif)"; // $imgExt[13] = "tif"; $imgExtNum[13] = 3;
- menuItem -label "Tiff16 (tif)"; // $imgExt[14] = "tif"; $imgExtNum[14] = 4;
- menuItem -label "Windows Bitmap (bmp)"; // $imgExt[15] = "bmp"; $imgExtNum[15] = 20;
- } else if ( `about -mac` ) {
- optionMenuGrp -label "Image Format" -cc changeImageFormat imageMenu;
- menuItem -label "JPEG (jpeg)"; // $imgExt[0] = "jpeg"; $imgExtNum[0] = 8;
- menuItem -label "Maya IFF (iff)"; // $imgExt[1] = "iff"; $imgExtNum[1] = 7;
- menuItem -label "Maya16 IFF (iff)"; // $imgExt[2] = "iff"; $imgExtNum[2] = 10;
- menuItem -label "MacPaint (pntg)"; // $imgExt[3] = "pntg"; $imgExtNum[3] = 30;
- menuItem -label "Photoshop (ps)"; // $imgExt[4] = "ps"; $imgExtNum[4] = 31;
- menuItem -label "PNG (png)"; // $imgExt[5] = "png"; $imgExtNum[5] = 32;
- menuItem -label "QuickDraw (pict)"; // $imgExt[6] = "pict"; $imgExtNum[6] = 33;
- menuItem -label "Quicktime Movie (qt)"; // $imgExt[7] = "qt"; $imgExtNum[7] = 22;
- menuItem -label "Quicktime Image (qtif)";// $imgExt[8] = "qtif"; $imgExtNum[8] = 34;
- menuItem -label "Silicon Graphics (sgi)";// $imgExt[9] = "sgi"; $imgExtNum[9] = 5;
- menuItem -label "Targa (tga)"; // $imgExt[10] = "tga"; $imgExtNum[10] = 19;
- menuItem -label "Tiff (tif)"; // $imgExt[11] = "tif"; $imgExtNum[11] = 3;
- menuItem -label "Windows Bitmap (bmp)"; // $imgExt[12] = "bmp"; $imgExtNum[12] = 20;
- } else {
- warning "Unsupported platform in renderGlobalsWindow.mel";
- }
-
- }
-
- scriptJob -p $parent
- -ac "defaultRenderGlobals.imageFormat"
- "updateImageFile; updateFileOutputFeedback;";
-
- // Renderable Objects ------------------------------------------------
-
- //Note: not updating if changed elsewhere
- optionMenuGrp -label "Renderable Objects" -cc changeRenderObj renderObjMenu;
- menuItem -label "Render All";
- menuItem -label "Render Active";
-
- // Cameras ------------------------------------------------
-
- //Note: not updating if changed elsewhere
- optionMenuGrp -label "Camera" -cc switchCamera cameraMenu;
-
- // Channels ------------------------------------------------
-
- //Note: none of these are updating if changed elsewhere
- checkBoxGrp -numberOfCheckBoxes 1
- -label "Channels"
- -label1 "RGB Channel (Color)"
- -cc updateCameraAttrs
- rgbChannel;
-
- checkBoxGrp -numberOfCheckBoxes 1
- -label1 "Alpha Channel (Mask)"
- -cc updateCameraAttrs
- alphaChannel;
-
- checkBoxGrp -numberOfCheckBoxes 1
- -label1 "Depth Channel (Z Depth)"
- -cc updateCameraAttrs
- depthChannel;
-
- setParent ..;
- setUITemplate -popTemplate;
- }
-
- global proc createExtensionOptions (string $parent)
- //
- // Procedure Name:
- // createExtensionOptions
- //
- // Description:
- // Creates the UI in the "Modify Extension" expand/collapse section.
- //
- {
- setUITemplate -pushTemplate attributeEditorTemplate;
-
- setParent $parent;
-
- // If the UI is created already then just update the attribute values.
- if (`columnLayout -exists rgExtOptionsLayout`) {
- updateExtOptions;
- return;
- }
-
- columnLayout -adjustableColumn true rgExtOptionsLayout;
-
- checkBoxGrp -numberOfCheckBoxes 1
- -label ""
- -label1 "Use Custom Extension:"
- -cc changeCustomExtensionCheck
- imageCheckBox;
- scriptJob -p $parent
- -ac "defaultRenderGlobals.outFormatControl"
- "updateExtOptions; updateFileOutputFeedback;";
-
- textFieldGrp -label ""
- -text `getAttr "defaultRenderGlobals.outFormatExt"`
- -cc changeCustomExtensionName
- userExt;
- scriptJob -p $parent
- -ac "defaultRenderGlobals.outFormatExt"
- "updateExtOptions; updateFileOutputFeedback;";
-
- setParent ..;
-
- // Make sure the values are right
- updateExtOptions;
- setUITemplate -popTemplate;
- }
-
- global proc createFrameOptions (string $parent)
- //
- // Procedure Name:
- // createFrameOptions
- //
- // Description:
- // Creates the UI in the "Renumber Frames" expand/collapse section.
- //
- {
- setUITemplate -pushTemplate attributeEditorTemplate;
-
- setParent $parent;
-
- // If the UI is created already then just update the attribute values.
- if (`columnLayout -exists rgFrameLayout`) {
- updateFrames;
- return;
- }
-
- columnLayout -adjustableColumn true rgFrameLayout;
-
- checkBoxGrp -numberOfCheckBoxes 1
- -label ""
- -label1 "Renumber Frames Using:"
- -cc "setAttr defaultRenderGlobals.modifyExtension #1; updateFrames; updateFileOutputFeedback"
- frameCheckBox;
- scriptJob -p $parent
- -ac "defaultRenderGlobals.modifyExtension"
- "updateFrames; updateFileOutputFeedback;";
-
- intFieldGrp -label "Start Number"
- -cc changeFrameExtension
- frameStartOverride;
- scriptJob -p $parent
- -ac "defaultRenderGlobals.startExtension"
- "updateFrames; updateFileOutputFeedback;";
-
- intFieldGrp -label "By Frame"
- -cc changeFrameExtension
- frameByOverride;
- scriptJob -p $parent
- -ac "defaultRenderGlobals.byExtension"
- "updateFrames; updateFileOutputFeedback;";
-
- setParent ..;
-
- // Make sure the values are right
- updateFrames;
- setUITemplate -popTemplate;
- }
-
- global proc createFieldOptions (string $parent)
- //
- // Procedure Name:
- // createFieldOptions
- //
- // Description:
- // Creates the UI in the "Field Options" expand/collapse section.
- //
- {
- setUITemplate -pushTemplate attributeEditorTemplate;
-
- setParent $parent;
- string $cName;
-
- // If the UI is created already then just update the attribute values.
- if (`columnLayout -exists rgFieldLayout`) {
- updateFieldOptions;
- return;
- }
-
- columnLayout -adjustableColumn true rgFieldLayout;
-
- optionMenuGrp -label "Render" -cc changeFieldOptions fieldMenu;
- menuItem -label "Frames";
- menuItem -label "Both Fields, Interlaced";
- menuItem -label "Both Fields, Separate";
- menuItem -label "Odd Fields";
- menuItem -label "Even Fields";
- scriptJob -p $parent
- -ac "defaultResolution.fields"
- "updateFieldOptions; updateFileOutputFeedback;";
-
- optionMenuGrp -label "Field Dominance"
- -cc "changeFieldOptions" fieldDominanceMenu;
- menuItem -label "Odd Field (NTSC)" rgOddField;
- menuItem -label "Even Field (PAL)" rgEvenField;
-
- radioButtonGrp -numberOfRadioButtons 2
- -label "Zeroth Scanline"
- -label1 "At Top"
- -label2 "At Bottom"
- -on1 "setAttr defaultResolution.zerothScanline 0"
- -on2 "setAttr defaultResolution.zerothScanline 1"
- scanlineButtons;
- scriptJob -p $parent
- -ac "defaultResolution.zerothScanline"
- "updateFieldOptions";
-
- separator;
-
- radioButtonGrp -numberOfRadioButtons 1
- -label ""
- -label1 "No Field Extension"
- -onc changeFieldOptions
- fieldButton1;
-
- radioButtonGrp -numberOfRadioButtons 1
- -shareCollection fieldButton1
- -label1 "Default Field Extension (o and e)"
- -onc changeFieldOptions
- fieldButton2;
-
- radioButtonGrp -numberOfRadioButtons 1
- -shareCollection fieldButton1
- -label1 "Custom Extension:"
- -onc changeFieldOptions
- fieldButton3;
-
- // This works on the above 3 radio buttons
- scriptJob -p $parent
- -ac "defaultRenderGlobals.fieldExtControl"
- "updateFieldOptions; updateFileOutputFeedback;";
-
- // Make these fields small to indicate that
- // only a single character is accepted.
- // There's a SUG on this. #87405
- //
- textFieldGrp -label "Odd Field"
- -cw 2 30
- -cc changeFieldOptions oddFieldExt;
- scriptJob -p $parent
- -ac "defaultRenderGlobals.oddFieldExt"
- "updateFieldOptions; updateFileOutputFeedback;";
-
- textFieldGrp -label "Even Field"
- -cw 2 30
- -cc changeFieldOptions evenFieldExt;
- scriptJob -p $parent
- -ac "defaultRenderGlobals.evenFieldExt"
- "updateFieldOptions; updateFileOutputFeedback;";
-
- setParent ..;
- setUITemplate -popTemplate;
-
- // Make sure the values are right
- updateFieldOptions;
- }
-
- global proc createResolution (string $parent)
- //
- // Procedure Name:
- // createResolution
- //
- // Description:
- // Creates the UI in the "Resolution" expand/collapse section.
- //
- {
- //
- // Make sure the list of predefined resolutions has been read in.
- //
- global string $gImageFormatData[];
- global string $gUserImageFormatData[];
-
- if (size($gImageFormatData) == 0) {
- eval("source imageFormats");
- }
-
- int $isMayaEvalVersion = `about -ev`;
- global string $gPLEImageFormatData[];
- if ( $isMayaEvalVersion ) {
- $gImageFormatData = $gPLEImageFormatData;
- }
-
- if (exists("userImageFormats.mel") && size($gUserImageFormatData) == 0) {
- // Yes, we need the eval here, to avoid doing the source
- // until we know whether the file actually exists
- eval("source userImageFormats");
- }
-
- setUITemplate -pushTemplate attributeEditorTemplate;
-
- setParent $parent;
- string $cName;
-
- // If the UI is created already then just update the attribute values.
- if (`columnLayout -exists rgResolutionLayout`) {
- updateResolution;
- return;
- }
-
- global string $gImageFormatData[];
- global string $gUserImageFormatData[];
- columnLayout -adjustableColumn true rgResolutionLayout;
- int $resItem;
- int $numResolutionPresets = size($gImageFormatData);
- int $numUserResolutionPresets = size($gUserImageFormatData);
- string $allResNodes[] = `ls -type resolution`;
- int $numResolutionNodePresets = size($allResNodes) - 1;
- int $numTokens;
- string $tokens[];
- string $niceName;
-
- optionMenuGrp -label "Presets"
- -cc "changeResolution" resolutionMenu;
- menuItem -label "Custom";
- for ($resItem = 0; $resItem < $numResolutionPresets; $resItem++) {
- string $item = $gImageFormatData[$resItem];
- $numTokens = tokenize($item, $tokens);
- //
- // Change any underscore into a space;
- // some names may have up to 2 underscores in them,
- // so we do this twice.
- $niceName = `substitute "_" $tokens[0] " "`;
- $niceName = `substitute "_" $niceName " "`;
- menuItem -label $niceName;
- }
- for ($resItem = 0; $resItem < $numUserResolutionPresets; $resItem++) {
- string $item = $gUserImageFormatData[$resItem];
- $numTokens = tokenize($item, $tokens);
- //
- // Change any underscore into a space;
- // some names may have up to 2 underscores in them,
- // so we do this twice.
- $niceName = `substitute "_" $tokens[0] " "`;
- $niceName = `substitute "_" $niceName " "`;
- menuItem -label $niceName;
- }
- for ($resItem = 0; $resItem < $numResolutionNodePresets; $resItem++) {
- menuItem -label $allResNodes[$resItem + 1];
- }
-
- separator;
-
- checkBoxGrp -numberOfCheckBoxes 1
- -label1 "Maintain Width/Height Ratio"
- -cc "setAttr defaultResolution.aspectLock #1;checkAspectLock \"defaultResolution\";updateResolution"
- aspectLockCheck;
-
- intFieldGrp -label "Width"
- -cc "changeAspectLockWidth"
- resWidth;
- intFieldGrp -label "Height"
- -cc changeAspectLockHeight
- resHeight;
-
- separator;
-
- checkBoxGrp -numberOfCheckBoxes 1
- -label1 "Lock Device Aspect Ratio"
- -cc "setAttr defaultResolution.lockDeviceAspectRatio #1; changeAspectLockWidth"
- ratioLockCheck;
-
- floatFieldGrp -label "Device Aspect Ratio"
- -cc "updateDeviceAspectRatio" resRatio;
-
- floatFieldGrp -label "Pixel Aspect Ratio"
- -cc "rgAdjustDeviceAspect \"defaultResolution\"" pixRatio;
-
- setParent ..;
- setUITemplate -popTemplate;
-
- // Make sure the values are right
- updateResolution;
- }
-
- global proc createRayTraceQuality (string $parent)
- //
- // Procedure Name:
- // createRayTraceQuality
- //
- // Description:
- // Creates the UI in the "Raytracing Quality"
- // expand/collapse section.
- //
- {
- setUITemplate -pushTemplate attributeEditorTemplate;
-
- setParent $parent;
- string $cName;
- string $rendQual[] = `listConnections defaultRenderGlobals.qual`;
-
- // If the UI is created already then reset the command with the correct
- // render quality + update the attribute values.
- if (`columnLayout -exists rgRaytraceLayout`) {
- checkBoxGrp -e
- -cc ("setAttr " + $rendQual[0] + ".enableRaytracing #1;updateRaytraceQuality")
- raytraceCheck;
- intSliderGrp -e
- -cc ("setAttr " + $rendQual[0] + ".reflections #1")
- reflectionsField;
- intSliderGrp -e
- -cc ("setAttr " + $rendQual[0] + ".refractions #1")
- refractionsField;
- intSliderGrp -e
- -cc ("setAttr " + $rendQual[0] + ".shadows #1")
- shadowsField;
- floatSliderGrp -e
- -cc ("setAttr " + $rendQual[0] + ".rayTraceBias #1")
- rayTraceBiasField;
-
- updateRaytraceQuality;
- return;
- }
-
- columnLayout -adjustableColumn true rgRaytraceLayout;
-
- checkBoxGrp -numberOfCheckBoxes 1
- -label1 "Raytracing"
- -cc ("setAttr " + $rendQual[0] + ".enableRaytracing #1;updateRaytraceQuality")
- raytraceCheck;
-
- intSliderGrp -label "Reflections"
- -cc ("setAttr " + $rendQual[0] + ".reflections #1")
- -min 0 -max 20 reflectionsField;
-
- intSliderGrp -label "Refractions"
- -cc ("setAttr " + $rendQual[0] + ".refractions #1")
- -min 0 -max 20 refractionsField;
-
- intSliderGrp -label "Shadows"
- -cc ("setAttr " + $rendQual[0] + ".shadows #1")
- -min 0 -max 20 shadowsField;
-
- floatSliderGrp -label "Bias"
- -cc ("setAttr " + $rendQual[0] + ".rayTraceBias #1")
- -min 0.0 -max 1.0 rayTraceBiasField;
-
- setParent ..;
- setUITemplate -popTemplate;
-
- // Make sure the values are right
- updateRaytraceQuality;
- }
-
- global proc createRenderQuality (string $parent)
- //
- // Procedure Name:
- // createRenderQuality
- //
- // Description:
- // Creates the UI in the "Anti-aliasing Quality"
- // expand/collapse section.
- //
- {
- setUITemplate -pushTemplate attributeEditorTemplate;
-
- setParent $parent;
- string $cName;
-
- // If the UI is created already then reset the command with the correct
- // render quality + update the attribute values.
- string $rendQual[] = `listConnections defaultRenderGlobals.qual`;
- if (`columnLayout -exists rgQualityLayout`) {
- intSliderGrp -e
- -cc ("setAttr " + $rendQual[0] + ".shadingSamples #1;updateRenderQuality")
- shadingSamplesField;
- intSliderGrp -e
- -cc ("setAttr " + $rendQual[0] + ".maxShadingSamples #1;updateRenderQuality")
- maxShadingSamplesField;
- intSliderGrp -e
- -cc ("setAttr " + $rendQual[0] + ".visibilitySamples #1;updateRenderQuality")
- visSamplesField;
- intSliderGrp -e
- -cc ("setAttr " + $rendQual[0] + ".maxVisibilitySamples #1;updateRenderQuality")
- maxVisSamplesField;
- intSliderGrp -e
- -cc ("setAttr " + $rendQual[0] + ".particleSamples #1;updateRenderQuality")
- particlesSamplesField;
- checkBoxGrp -e
- -cc ("setAttr " + $rendQual[0] + ".useMultiPixelFilter #1;updateRenderQuality")
- pixelCheck;
- floatSliderGrp -e
- -cc ("setAttr " + $rendQual[0] + ".pixelFilterWidthX #1")
- filterXField;
- floatSliderGrp -e
- -cc ("setAttr " + $rendQual[0] + ".pixelFilterWidthY #1")
- filterYField;
- floatSliderGrp -e
- -cc ("setAttr " + $rendQual[0] + ".redThreshold #1; updateRenderQuality")
- contrastRedField;
- floatSliderGrp -e
- -cc ("setAttr " + $rendQual[0] + ".greenThreshold #1; updateRenderQuality")
- contrastGreenField;
- floatSliderGrp -e
- -cc ("setAttr " + $rendQual[0] + ".blueThreshold #1; updateRenderQuality")
- contrastBlueField;
- floatSliderGrp -e
- -cc ("setAttr " + $rendQual[0] + ".coverageThreshold #1")
- contrastCoverField;
-
- updateRenderQuality;
- return;
- }
-
- columnLayout -adjustableColumn true rgQualityLayout;
-
- frameLayout
- -labelVisible false -borderVisible true
- -borderStyle "etchedIn"
- -collapsable false -collapse true;
- columnLayout -adjustableColumn true;
-
- optionMenuGrp -label "Presets" qualityPresetMenu;
- optionMenuGrp -edit -cc RGsetDefaultQuality -cw 2 240 qualityPresetMenu;
-
- menuItem -label "Custom" rgCustomQuality;
- menuItem -label "Preview Quality" rgPreviewQuality;
- menuItem -label "Intermediate Quality" rgIntermediateQuality;
- menuItem -label "Production Quality" rgProductionQuality;
- menuItem -label "Contrast Sensitive Production" rgContrastProductionQuality;
- menuItem -label "3D Motion Blur Production" rgMotionBlurQuality;
-
- optionMenuGrp -label "Edge Anti-aliasing"
- -cc RGsetEdgeQuality edgeMenu;
-
- menuItem -label "Low Quality";
- menuItem -label "Medium Quality";
- menuItem -label "High Quality";
- menuItem -label "Highest Quality";
-
- setParent ..;
- setParent ..;
-
- frameLayout -label "Number of Samples"
- -labelVisible true -borderVisible true
- -borderStyle "etchedIn"
- -labelAlign "center" -labelWidth 150
- -collapsable false -collapse true;
- columnLayout -adjustableColumn true;
-
- intSliderGrp -label "Shading"
- -cc ("setAttr " + $rendQual[0] + ".shadingSamples #1;updateRenderQuality")
- -min 1 -max 20 shadingSamplesField;
-
- intSliderGrp -label "Max Shading"
- -cc ("setAttr " + $rendQual[0] + ".maxShadingSamples #1;updateRenderQuality")
- -min 1 -max 20 maxShadingSamplesField;
-
- intSliderGrp -label "3D Blur Visib."
- -cc ("setAttr " + $rendQual[0] + ".visibilitySamples #1;updateRenderQuality")
- -min 1 -max 20 visSamplesField;
-
- intSliderGrp -label "Max 3D Blur Visib."
- -cc ("setAttr " + $rendQual[0] + ".maxVisibilitySamples #1;updateRenderQuality")
- -min 1 -max 20 maxVisSamplesField;
-
- intSliderGrp -label "Particles"
- -cc ("setAttr " + $rendQual[0] + ".particleSamples #1;updateRenderQuality")
- -min 1 -max 20 particlesSamplesField;
-
- setParent ..;
- setParent ..;
-
- frameLayout -label "Multipixel Filtering"
- -labelVisible true -borderVisible true
- -borderStyle "etchedIn"
- -labelAlign "center" -labelWidth 150
- -collapsable false -collapse true;
- columnLayout -adjustableColumn true;
-
- checkBoxGrp -numberOfCheckBoxes 1
- -label1 "Use Multi Pixel Filter"
- -cc ("setAttr " + $rendQual[0] + ".useMultiPixelFilter #1;updateRenderQuality")
- pixelCheck;
-
- optionMenuGrp -label "Pixel Filter Type"
- -cc "RGsetPixelFilterType" pixelFilterMenu;
-
- menuItem -label "Box Filter";
- menuItem -label "Triangle Filter";
- menuItem -label "Gaussian Filter";
- menuItem -label "Quadratic B-Spline Filter";
- menuItem -label "Plug-in Filter";
-
- floatSliderGrp -label "Pixel Filter Width X"
- -cc ("setAttr " + $rendQual[0] + ".pixelFilterWidthX #1")
- -min 1.0 -max 3.0 filterXField;
-
- floatSliderGrp -label "Pixel Filter Width Y"
- -cc ("setAttr " + $rendQual[0] + ".pixelFilterWidthY #1")
- -min 1.0 -max 3.0 filterYField;
-
- setParent ..;
- setParent ..;
-
-
- frameLayout -label "Contrast Threshold"
- -labelVisible true -borderVisible true
- -borderStyle "etchedIn"
- -labelAlign "center" -labelWidth 150
- -collapsable false -collapse true;
- columnLayout -adjustableColumn true;
-
- floatSliderGrp -label "Red"
- -cc ("setAttr " + $rendQual[0] + ".redThreshold #1; updateRenderQuality")
- -min 0.0 -max 1.0 contrastRedField;
-
- floatSliderGrp -label "Green"
- -cc ("setAttr " + $rendQual[0] + ".greenThreshold #1; updateRenderQuality")
- -min 0.0 -max 1.0 contrastGreenField;
-
- floatSliderGrp -label "Blue"
- -cc ("setAttr " + $rendQual[0] + ".blueThreshold #1; updateRenderQuality")
- -min 0.0 -max 1.0 contrastBlueField;
-
- floatSliderGrp -label "Coverage"
- -cc ("setAttr " + $rendQual[0] + ".coverageThreshold #1")
- -min 0.0 -max 1.0 contrastCoverField;
-
- setParent ..;
- setParent ..;
-
- setParent ..;
- setUITemplate -popTemplate;
-
- // Make sure the values are right
- updateRenderQuality;
- }
-
- global proc RGsetPixelFilterType()
- {
- string $rendQual[] = `listConnections defaultRenderGlobals.qual`;
- string $curr = `optionMenuGrp -q -v pixelFilterMenu`;
- if ($curr == "Box Filter") {
- setAttr ($rendQual[0] + ".pixelFilterType") 0;
- } else if ($curr == "Triangle Filter") {
- setAttr ($rendQual[0] + ".pixelFilterType") 2;
- } else if ($curr == "Gaussian Filter") {
- setAttr ($rendQual[0] + ".pixelFilterType") 4;
- } else if ($curr == "Quadratic B-Spline Filter") {
- setAttr ($rendQual[0] + ".pixelFilterType") 5;
- } else if ($curr == "Plug-in Filter") {
- setAttr ($rendQual[0] + ".pixelFilterType") 1000;
- }
- updateRenderQuality;
- }
-
- global proc RGsetDefaultQuality ()
- {
- string $rendQual[] = `listConnections defaultRenderGlobals.qual`;
- string $curr = `optionMenuGrp -q -v qualityPresetMenu`;
- if ($curr == "Preview Quality") {
- setAttr ($rendQual[0] + ".edgeAntiAliasing") 3;
- setAttr ($rendQual[0] + ".useMultiPixelFilter") 0;
- setAttr ($rendQual[0] + ".shadingSamples") 1;
- setAttr ($rendQual[0] + ".maxShadingSamples") 1;
- setAttr ($rendQual[0] + ".visibilitySamples") 1;
- setAttr ($rendQual[0] + ".maxVisibilitySamples") 4;
- setAttr ($rendQual[0] + ".redThreshold") 0.4;
- setAttr ($rendQual[0] + ".greenThreshold") 0.3;
- setAttr ($rendQual[0] + ".blueThreshold") 0.6;
- setAttr ($rendQual[0] + ".reflections") 1;
- setAttr ($rendQual[0] + ".refractions") 6;
- setAttr ($rendQual[0] + ".shadows") 2;
- } else if ($curr == "Intermediate Quality") {
- setAttr ($rendQual[0] + ".edgeAntiAliasing") 0;
- setAttr ($rendQual[0] + ".useMultiPixelFilter") 0;
- setAttr ($rendQual[0] + ".shadingSamples") 1;
- setAttr ($rendQual[0] + ".maxShadingSamples") 8;
- setAttr ($rendQual[0] + ".visibilitySamples") 1;
- setAttr ($rendQual[0] + ".maxVisibilitySamples") 4;
- setAttr ($rendQual[0] + ".redThreshold") 0.4;
- setAttr ($rendQual[0] + ".greenThreshold") 0.3;
- setAttr ($rendQual[0] + ".blueThreshold") 0.6;
- setAttr ($rendQual[0] + ".reflections") 1;
- setAttr ($rendQual[0] + ".refractions") 6;
- setAttr ($rendQual[0] + ".shadows") 2;
- } else if ($curr == "Production Quality") {
- setAttr ($rendQual[0] + ".edgeAntiAliasing") 0;
- setAttr ($rendQual[0] + ".useMultiPixelFilter") 1;
- setAttr ($rendQual[0] + ".shadingSamples") 2;
- setAttr ($rendQual[0] + ".maxShadingSamples") 8;
- setAttr ($rendQual[0] + ".visibilitySamples") 1;
- setAttr ($rendQual[0] + ".maxVisibilitySamples") 4;
- setAttr ($rendQual[0] + ".redThreshold") 0.4;
- setAttr ($rendQual[0] + ".greenThreshold") 0.3;
- setAttr ($rendQual[0] + ".blueThreshold") 0.6;
- setAttr ($rendQual[0] + ".reflections") 10;
- setAttr ($rendQual[0] + ".refractions") 10;
- setAttr ($rendQual[0] + ".shadows") 10;
- } else if ($curr == "Contrast Sensitive Production") {
- setAttr ($rendQual[0] + ".edgeAntiAliasing") 0;
- setAttr ($rendQual[0] + ".useMultiPixelFilter") 1;
- setAttr ($rendQual[0] + ".shadingSamples") 2;
- setAttr ($rendQual[0] + ".maxShadingSamples") 8;
- setAttr ($rendQual[0] + ".visibilitySamples") 1;
- setAttr ($rendQual[0] + ".maxVisibilitySamples") 4;
- setAttr ($rendQual[0] + ".redThreshold") 0.2;
- setAttr ($rendQual[0] + ".greenThreshold") 0.15;
- setAttr ($rendQual[0] + ".blueThreshold") 0.3;
- setAttr ($rendQual[0] + ".reflections") 10;
- setAttr ($rendQual[0] + ".refractions") 10;
- setAttr ($rendQual[0] + ".shadows") 10;
- } else if ($curr == "3D Motion Blur Production") {
- setAttr ($rendQual[0] + ".edgeAntiAliasing") 0;
- setAttr ($rendQual[0] + ".useMultiPixelFilter") 1;
- setAttr ($rendQual[0] + ".shadingSamples") 3;
- setAttr ($rendQual[0] + ".maxShadingSamples") 8;
- setAttr ($rendQual[0] + ".visibilitySamples") 1;
- setAttr ($rendQual[0] + ".maxVisibilitySamples") 4;
- setAttr ($rendQual[0] + ".redThreshold") 0.4;
- setAttr ($rendQual[0] + ".greenThreshold") 0.3;
- setAttr ($rendQual[0] + ".blueThreshold") 0.6;
- setAttr ($rendQual[0] + ".reflections") 10;
- setAttr ($rendQual[0] + ".refractions") 10;
- setAttr ($rendQual[0] + ".shadows") 10;
- }
- updateRenderQuality;
-
- if (`columnLayout -exists rgRaytraceLayout`) updateRaytraceQuality;
- }
-
- global proc RGsetEdgeQuality()
- {
- string $rendQual[] = `listConnections defaultRenderGlobals.qual`;
- string $curr = `optionMenuGrp -q -v edgeMenu`;
- if ($curr == "Low Quality") {
- setAttr ($rendQual[0] + ".edgeAntiAliasing") 3;
- } else if ($curr == "Medium Quality") {
- setAttr ($rendQual[0] + ".edgeAntiAliasing") 2;
- } else if ($curr == "High Quality") {
- setAttr ($rendQual[0] + ".edgeAntiAliasing") 1;
- } else {
- setAttr ($rendQual[0] + ".edgeAntiAliasing") 0;
- }
-
- updateRenderQuality;
- }
-
- global proc createRenderOptions (string $parent)
- //
- // Procedure Name:
- // createRenderOptions
- //
- // Description:
- // Creates the UI in the "Render Options" expand/collapse section.
- //
- {
- setUITemplate -pushTemplate attributeEditorTemplate;
-
- setParent $parent;
- string $cName;
-
- // If the UI is created already then just update the attribute values.
- if (`columnLayout -exists rgOptionsLayout`) {
- updateRenderOptions;
- return;
- }
-
- columnLayout -adjustableColumn true rgOptionsLayout;
-
- textFieldGrp -label "Plug-in Format"
- -cc "setAttr defaultRenderGlobals.pluginFormat -type \"string\" \"#1\""
- plugInFormat;
-
- textFieldGrp -label "Pre Render MEL"
- -cc "setAttr defaultRenderGlobals.preRenderMel -type \"string\" \"#1\""
- preRenderMel;
-
- textFieldGrp -label "Post Render MEL"
- -cc "setAttr defaultRenderGlobals.postRenderMel -type \"string\" \"#1\""
- postRenderMel;
-
- separator;
- attrNavigationControlGrp -l "Environment Fog"
- -at defaultRenderGlobals.fogGeometry envFogControl;
- if (`isTrue MayaCreatorExists`) {
- checkBoxGrp -numberOfCheckBoxes 1
- -label1 "Apply Fog in Post"
- -cc "setAttr defaultRenderGlobals.applyFogInPost #1;intFieldGrp -edit -enable #1 postFogBlurField;"
- applyFogInPostCheck;
- intFieldGrp -label "Post Fog Blur"
- -cc "setAttr defaultRenderGlobals.postFogBlur #1"
- -enable `getAttr defaultRenderGlobals.applyFogInPost`
- postFogBlurField;
- separator;
- }
-
- checkBoxGrp -numberOfCheckBoxes 1
- -label1 "Shadows Obey Light Linking"
- -cc "setAttr defaultRenderGlobals.shadowsObeyLightLinking #1;"
- shadowLightLinkCheck;
-
- checkBoxGrp -numberOfCheckBoxes 1
- -label1 "Enable Depth Maps"
- -cc "setAttr defaultRenderGlobals.enableDepthMaps #1"
- depthMapCheck;
-
- checkBoxGrp -numberOfCheckBoxes 1
- -label1 "Enable Default Light"
- -cc "setAttr defaultRenderGlobals.enableDefaultLight #1"
- defaultLightCheck;
-
- checkBoxGrp -numberOfCheckBoxes 1
- -label1 "Ignore Film Gate"
- -cc "setAttr defaultRenderGlobals.ignoreFilmGate #1"
- filmGateCheck;
-
- checkBoxGrp -numberOfCheckBoxes 1
- -label1 "Clip Final Shaded Color"
- -cc "setAttr defaultRenderGlobals.clipFinalShadedColor #1"
- clipCheck;
-
- checkBoxGrp -numberOfCheckBoxes 1
- -label1 "Jitter Final Color"
- -cc "setAttr defaultRenderGlobals.jitterFinalColor #1"
- jitterColor;
-
- floatFieldGrp -label "Gamma Correction"
- -cc "setAttr defaultRenderGlobals.gammaCorrection #1"
- gammaField;
-
- separator;
-
- checkBoxGrp -numberOfCheckBoxes 1
- -label1 "Composite"
- -cc "setAttr defaultRenderGlobals.composite #1;floatFieldGrp -edit -enable #1 compValueField;"
- compCheck;
-
- floatFieldGrp -label "Composite Threshold"
- -cc "setAttr defaultRenderGlobals.compositeThreshold #1"
- compValueField;
-
- setParent ..;
- setUITemplate -popTemplate;
-
- // Make sure the values are right
- updateRenderOptions;
- }
-
-
- global proc updateNumCpusSlider(int $value)
- //
- // Procedure Name:
- // updateNumCpusSlider
- //
- // Description:
- // When the controls for the number of CPUs are updated this
- // procedure will be invoked. The check box, field and slider
- // will be update to reflect the new value. If the value is
- // zero, all CPUs will be used.
- //
- {
- if ( `about -evalVersion` ) {
- warning( "Maya Personal Learning Edition limits rendering to a single CPU");
- checkBoxGrp -e -enable false -value1 false numCpusCheckBox;
- intSliderGrp -e -enable false -value 1 numCpusSlider;
- return;
- }
-
- if ($value == 0) {
- checkBoxGrp -e -value1 true numCpusCheckBox;
-
- intSliderGrp -e -enable false -value $value numCpusSlider;
- }
- else {
- checkBoxGrp -e -value1 false numCpusCheckBox;
-
- intSliderGrp -e -enable true -value $value numCpusSlider;
-
- if (`iprEngine -query -exists defaultIprEngine`) {
- warning -showLineNumber false
- ("IPR will need to be closed before this change in CPUs will"+
- " take effect.");
- }
- }
-
- setAttr defaultRenderGlobals.numCpusToUse $value;
- }
-
- global proc updatePerformanceOptions ()
- //
- // Procedure Name:
- // updatePerformanceOptions
- //
- // Description:
- // Gets the real values from the nodes and sets the UI based
- // on these values. This procedure updates all of the memory
- // and performance values.
- //
- {
- checkBoxGrp -edit
- -v1 `getAttr defaultRenderGlobals.useFileCache`
- cacheCheck;
-
- checkBoxGrp -edit
- -v1 `getAttr defaultRenderGlobals.optimizeInstances`
- optCheck;
-
- checkBoxGrp -edit
- -v1 `getAttr defaultRenderGlobals.reuseTessellations`
- reuseCheck;
-
- checkBoxGrp -edit
- -v1 `getAttr defaultRenderGlobals.useDisplacementBoundingBox`
- dispBBCheck;
-
- intSliderGrp -edit
- -v `getAttr defaultRenderGlobals.recursionDepth`
- recursionDepth;
-
- intSliderGrp -edit
- -v `getAttr defaultRenderGlobals.leafPrimitives`
- leafPrim;
-
- floatSliderGrp -edit
- -v `getAttr defaultRenderGlobals.subdivisionPower`
- subPower;
-
- // intSliderGrp -edit
- // -v `getAttr defaultRenderGlobals.subdivisionHashSize`
- // subHash;
-
- updateNumCpusSlider(`getAttr defaultRenderGlobals.numCpusToUse`);
- }
-
-
- global proc createPerformanceOptions (string $parent)
- //
- // Procedure Name:
- // createPerformanceOptions
- //
- // Description:
- // Creates the UI in the "Memory and Performance Options"
- // expand/collapse section.
- //
- {
- setUITemplate -pushTemplate attributeEditorTemplate;
-
- setParent $parent;
- string $cName;
-
- // If the UI is created already then just update the attribute values.
- if (`columnLayout -exists rgPerformanceLayout`) {
- updatePerformanceOptions;
- return;
- }
-
- columnLayout -adjustableColumn true rgPerformanceLayout;
-
- frameLayout -label "Tessellation"
- -labelVisible true -borderVisible true
- -borderStyle "etchedIn"
- -labelAlign "center" -labelWidth 100
- -collapsable false -collapse true;
- columnLayout -adjustableColumn true;
-
- checkBoxGrp -numberOfCheckBoxes 1
- -label1 "Use File Cache"
- -cc "setAttr defaultRenderGlobals.useFileCache #1;"
- cacheCheck;
-
- checkBoxGrp -numberOfCheckBoxes 1
- -label1 "Optimize Instances"
- -cc "setAttr defaultRenderGlobals.optimizeInstances #1;"
- optCheck;
-
- checkBoxGrp -numberOfCheckBoxes 1
- -label1 "Reuse Tessellations"
- -cc "setAttr defaultRenderGlobals.reuseTessellations #1;"
- reuseCheck;
-
- checkBoxGrp -numberOfCheckBoxes 1
- -label1 "Use Displacement Bounding Box"
- -cc "setAttr defaultRenderGlobals.useDisplacementBoundingBox #1;"
- dispBBCheck;
-
- setParent ..;
- setParent ..;
-
- frameLayout -label "Ray Tracing"
- -labelVisible true -borderVisible true
- -borderStyle "etchedIn"
- -labelAlign "center" -labelWidth 100
- -collapsable false -collapse true;
- columnLayout -adjustableColumn true;
-
- intSliderGrp -label "Recursion Depth"
- -min 1 -max 5
- -cc "setAttr defaultRenderGlobals.recursionDepth `intSliderGrp -q -v recursionDepth`"
- recursionDepth;
-
- intSliderGrp -label "Leaf Primitives"
- -min 20 -max 200
- -cc "setAttr defaultRenderGlobals.leafPrimitives `intSliderGrp -q -v leafPrim`"
- leafPrim;
-
- floatSliderGrp -label "Subdivision Power"
- -min 0.01 -max 1.0
- -cc "setAttr defaultRenderGlobals.subdivisionPower `floatSliderGrp -q -v subPower`"
- subPower;
-
- // intSliderGrp -label "Subdiv Hash Size"
- // -min 1 -max 100
- // -cc "setAttr defaultRenderGlobals.subdivisionHashSize `intSliderGrp -q -v subHash`"
- // subHash;
-
- setParent ..;
- setParent ..;
-
- frameLayout -label "Multi Processing"
- -labelVisible true -borderVisible true
- -borderStyle "etchedIn"
- -labelAlign "center" -labelWidth 100
- -collapsable false -collapse true;
- columnLayout -adjustableColumn true;
-
- checkBoxGrp -numberOfCheckBoxes 1
- -label1 "Use All Available CPUs"
- -cc "updateNumCpusSlider(#1 ? 0 : 1)"
- numCpusCheckBox;
-
- intSliderGrp
- -label "Num. CPUs to Use"
- -cc "updateNumCpusSlider(#1)"
- -minValue 1 -maxValue 8
- -fieldMinValue 0 -fieldMaxValue 256
- numCpusSlider;
-
- setParent ..;
- setParent ..;
-
- setParent ..;
- setUITemplate -popTemplate;
-
- // Make sure the values are right
- updatePerformanceOptions;
- }
-
-
- global proc updateIPROptions ()
- //
- // Procedure Name:
- // updateIPROptions
- //
- // Description:
- // Gets the real values from the option vars and sets the UI based
- // on these values. This procedure updates all of the IPR
- // values.
- //
- {
- int $doShading = `optionVar -query iprRenderShading`;
- checkBoxGrp -edit -v1 $doShading iprShadingCheck;
- checkBoxGrp -edit -v1 `optionVar -query iprRenderShadowMaps`
- -enable $doShading iprShadowCheck;
- checkBoxGrp -edit -v1 `optionVar -query iprRenderMotionBlur` ipr2DBlurCheck;
- }
-
- global proc updateIPRShadingOptionVar()
- {
- int $doShading = `checkBoxGrp -q -v1 iprShadingCheck`;
- optionVar -intValue iprRenderShading $doShading;
- checkBoxGrp -edit -enable $doShading iprShadowCheck;
- }
-
- global proc updateIPRShadowOptionVar()
- {
- int $doShadows = `checkBoxGrp -q -v1 iprShadowCheck`;
- optionVar -intValue iprRenderShadowMaps $doShadows;
- }
-
- global proc updateIPR2dBlurOptionVar()
- {
- int $doBlur = `checkBoxGrp -q -v1 ipr2DBlurCheck`;
- optionVar -intValue iprRenderMotionBlur $doBlur;
- }
-
- global proc createIPROptions (string $parent)
- //
- // Procedure Name:
- // createIPROptions
- //
- // Description:
- // Creates the UI in the "IPR Render Globals"
- // expand/collapse section.
- //
- {
- setUITemplate -pushTemplate attributeEditorTemplate;
-
- setParent $parent;
- string $cName;
-
- // If the UI is created already then just update the attribute values.
- if (`columnLayout -exists rgIPRLayout`) {
- updateIPROptions;
- return;
- }
-
- columnLayout -adjustableColumn true rgIPRLayout;
- checkBoxGrp -numberOfCheckBoxes 1
- -label1 "Render Shading, Lighting and Glow"
- -cc "updateIPRShadingOptionVar"
- iprShadingCheck;
-
- checkBoxGrp -numberOfCheckBoxes 1
- -label1 "Render Shadow Maps"
- -cc "updateIPRShadowOptionVar"
- iprShadowCheck;
-
- checkBoxGrp -numberOfCheckBoxes 1
- -label1 "Render 2D Motion Blur"
- -cc "updateIPR2dBlurOptionVar"
- ipr2DBlurCheck;
-
- setParent ..;
- setUITemplate -popTemplate;
-
- // Make sure the values are right
- updateIPROptions;
- }
-
- global proc updateUrchinOptions ()
- //
- // Procedure Name:
- // updateUrchinOptions
- //
- // Description:
- // Gets the real values from the nodes and sets the UI based
- // on these values. This procedure updates all of the memory
- // and performance values. I guess hard-coding the render globals
- // name is okay until we handle multiple nodes, and since every
- // other routine in this file makes that assumption, so will I.
- //
- {
- checkBoxGrp -edit
- -v1 `getAttr defaultRenderGlobals.enableStrokeRender`
- enableStrokesCheck;
-
- checkBoxGrp -edit
- -v1 `getAttr defaultRenderGlobals.onlyRenderStrokes`
- onlyStrokesCheck;
-
- checkBoxGrp -edit
- -v1 `getAttr defaultRenderGlobals.oversamplePaintEffects`
- oversamplePaintEffectsCheck;
-
- checkBoxGrp -edit
- -v1 `getAttr defaultRenderGlobals.oversamplePfxPostFilter`
- oversamplePfxPostFilterCheck;
-
- string $strokesFile = `getAttr defaultRenderGlobals.strokesDepthFile`;
- textFieldGrp -edit
- -fileName $strokesFile
- depthStrokesCheck;
-
- // Now update the UI greyed/enabled state.
- int $value1 = `getAttr defaultRenderGlobals.enableStrokeRender`;
- if ($value1 == 1) {
- int $value2 = `getAttr defaultRenderGlobals.onlyRenderStrokes`;
- int $value3 = `getAttr defaultRenderGlobals.oversamplePaintEffects`;
- if ($value2 == 1) {
- textFieldGrp -edit -en true depthStrokesCheck;
- }
- else {
- textFieldGrp -edit -en false depthStrokesCheck;
- }
- if( $value3 == 1 ){
- checkBoxGrp -edit -en true oversamplePfxPostFilterCheck;
- } else {
- checkBoxGrp -edit -en false oversamplePfxPostFilterCheck;
- }
- checkBoxGrp -edit -en true onlyStrokesCheck;
- checkBoxGrp -edit -en true oversamplePaintEffectsCheck;
- } else {
- textFieldGrp -edit -en false depthStrokesCheck;
- checkBoxGrp -edit -en false onlyStrokesCheck;
- checkBoxGrp -edit -en false oversamplePaintEffectsCheck;
- checkBoxGrp -edit -en false oversamplePfxPostFilterCheck;
- }
- }
-
- global proc setRenderGlobalsDepthFile()
- {
- setAttr defaultRenderGlobals.strokesDepthFile -type "string"
- `textFieldGrp -q -fileName depthStrokesCheck`;
- }
-
- global proc createUrchinOptions (string $parent)
- //
- // Procedure Name:
- // createUrchinOptions
- //
- // Description:
- // Creates the UI in the "Paint Effects Rendering Options"
- // expand/collapse section.
- //
- {
- setUITemplate -pushTemplate attributeEditorTemplate;
-
- setParent $parent;
- string $cName;
-
- // If the UI is created already then just update the attribute values.
- if (`columnLayout -exists rgUrchinLayout`) {
- updateUrchinOptions;
- return;
- }
-
- columnLayout -adjustableColumn true rgUrchinLayout;
-
- checkBoxGrp -numberOfCheckBoxes 1
- -label1 "Enable Stroke Rendering"
- -cc "setAttr defaultRenderGlobals.enableStrokeRender #1; updateUrchinOptions;"
- enableStrokesCheck;
-
- checkBoxGrp -numberOfCheckBoxes 1
- -label1 "Oversample"
- -cc "setAttr defaultRenderGlobals.oversamplePaintEffects #1; updateUrchinOptions;"
- oversamplePaintEffectsCheck;
-
- checkBoxGrp -numberOfCheckBoxes 1
- -label1 "Oversample Post Filter"
- -cc "setAttr defaultRenderGlobals.oversamplePfxPostFilter #1; updateUrchinOptions;"
- oversamplePfxPostFilterCheck;
-
- checkBoxGrp -numberOfCheckBoxes 1
- -label1 "Only Render Strokes"
- -cc "setAttr defaultRenderGlobals.onlyRenderStrokes #1 ; updateUrchinOptions;"
- onlyStrokesCheck;
-
- textFieldGrp -label "Read This Depth File"
- -cc "setRenderGlobalsDepthFile"
- depthStrokesCheck;
-
- setParent ..;
- setUITemplate -popTemplate;
-
- // Make sure the values are right
- updateUrchinOptions;
- }
-
- //==================================================================
- //
- // Add Context Sensitive Help
- //
- //==================================================================
-
- global proc buildRenderGlobalsContextHelpItems(string $nameRoot, string $menuParent)
- {
- menuItem -label "Help on Render Globals..."
- -enableCommandRepeat false
- -command "showHelp RenderGlobals";
- }
-
- //==================================================================
- //
- // Support for Presets
- //
- //==================================================================
-
- global proc renderGlobalsRevertToDefault()
- {
- //
- // Description:
- // This procedure is called when the user chooses Default Settings from
- // the Presets->Load Preset menu.
- // This procedure performs setAttrs on the attributes of the
- // defaultRenderGlobals, defaultResolution and defaultRenderQuality nodes
- // to set them to their default values.
- // This procedure does not attempt to deal with resolution or quality
- // nodes other than the two default nodes. In the future, this procedure
- // will be replaced by functionality in the nodePreset command that can
- // set an arbitrary node back to its default values.
- //
-
- // Set defaultRenderGlobals to default values
- //
- setAttr "defaultRenderGlobals.caching" no;
- setAttr "defaultRenderGlobals.isHistoricallyInteresting" 2;
- setAttr "defaultRenderGlobals.nodeState" 0;
- setAttr "defaultRenderGlobals.renderAll" yes;
- setAttr "defaultRenderGlobals.ignoreFilmGate" yes;
- setAttr "defaultRenderGlobals.clipFinalShadedColor" yes;
- setAttr "defaultRenderGlobals.enableDepthMaps" yes;
- setAttr "defaultRenderGlobals.enableDefaultLight" yes;
- setAttr "defaultRenderGlobals.enableStrokeRender" yes;
- setAttr "defaultRenderGlobals.oversamplePaintEffects" no;
- setAttr "defaultRenderGlobals.oversamplePfxPostFilter" no;
- setAttr "defaultRenderGlobals.onlyRenderStrokes" no;
- setAttr "defaultRenderGlobals.strokesDepthFile" -type "string" "";
- setAttr "defaultRenderGlobals.imageFormat" 7;
- setAttr "defaultRenderGlobals.pluginFormat" -type "string" "";
- setAttr "defaultRenderGlobals.gammaCorrection" 1;
- setAttr "defaultRenderGlobals.topRegion" 256;
- setAttr "defaultRenderGlobals.leftRegion" 0;
- setAttr "defaultRenderGlobals.bottomRegion" 0;
- setAttr "defaultRenderGlobals.rightRegion" 256;
- setAttr "defaultRenderGlobals.useRenderRegion" no;
- setAttr "defaultRenderGlobals.animation" no;
- setAttr "defaultRenderGlobals.animationRange" 1;
- setAttr "defaultRenderGlobals.startFrame" 1;
- setAttr "defaultRenderGlobals.endFrame" 10;
- setAttr "defaultRenderGlobals.byFrame" 1;
- setAttr "defaultRenderGlobals.byFrameStep" 1;
- setAttr "defaultRenderGlobals.modifyExtension" no;
- setAttr "defaultRenderGlobals.startExtension" 1;
- setAttr "defaultRenderGlobals.byExtension" 1;
- setAttr "defaultRenderGlobals.extensionPadding" 1;
- setAttr "defaultRenderGlobals.fieldExtControl" 0;
- setAttr "defaultRenderGlobals.stereoExtControl" 0;
- setAttr "defaultRenderGlobals.outFormatControl" 0;
- setAttr "defaultRenderGlobals.oddFieldExt" -type "string" "";
- setAttr "defaultRenderGlobals.evenFieldExt" -type "string" "";
- setAttr "defaultRenderGlobals.leftStereoExt" -type "string" "";
- setAttr "defaultRenderGlobals.rightStereoExt" -type "string" "";
- setAttr "defaultRenderGlobals.outFormatExt" -type "string" "";
- setAttr "defaultRenderGlobals.useMayaFileName" yes;
- setAttr "defaultRenderGlobals.useFrameExt" no;
- setAttr "defaultRenderGlobals.putFrameBeforeExt" no;
- setAttr "defaultRenderGlobals.imageFilePrefix" -type "string" "";
- setAttr "defaultRenderGlobals.periodInExt" yes;
- setAttr "defaultRenderGlobals.composite" no;
- setAttr "defaultRenderGlobals.compositeThreshold" 0;
- setAttr "defaultRenderGlobals.shadowsObeyLightLinking" yes;
- setAttr "defaultRenderGlobals.recursionDepth" 2;
- setAttr "defaultRenderGlobals.leafPrimitives" 200;
- setAttr "defaultRenderGlobals.subdivisionPower" 0.25;
- setAttr "defaultRenderGlobals.subdivisionHashSize" 5;
- setAttr "defaultRenderGlobals.logRenderPerformance" no;
- setAttr "defaultRenderGlobals.geometryVector" 20;
- setAttr "defaultRenderGlobals.shadingVector" 60;
- setAttr "defaultRenderGlobals.maximumMemory" 48;
- setAttr "defaultRenderGlobals.numCpusToUse" 0;
- setAttr "defaultRenderGlobals.shadowPass" no;
- setAttr "defaultRenderGlobals.iprShadowPass" no;
- setAttr "defaultRenderGlobals.useFileCache" yes;
- setAttr "defaultRenderGlobals.optimizeInstances" yes;
- setAttr "defaultRenderGlobals.reuseTessellations" yes;
- setAttr "defaultRenderGlobals.motionBlur" no;
- setAttr "defaultRenderGlobals.motionBlurByFrame" 1;
- setAttr "defaultRenderGlobals.applyFogInPost" no;
- setAttr "defaultRenderGlobals.postFogBlur" 1;
- setAttr "defaultRenderGlobals.preRenderMel" -type "string" "";
- setAttr "defaultRenderGlobals.postRenderMel" -type "string" "";
- setAttr "defaultRenderGlobals.preFurRenderMel" -type "string" "";
- setAttr "defaultRenderGlobals.postFurRenderMel" -type "string" "";
- setAttr "defaultRenderGlobals.createIprFile" no;
- setAttr "defaultRenderGlobals.blurLength" 1;
- setAttr "defaultRenderGlobals.blurSharpness" 1;
- setAttr "defaultRenderGlobals.smoothValue" 2;
- setAttr "defaultRenderGlobals.useBlur2DMemoryCap" yes;
- setAttr "defaultRenderGlobals.blur2DMemoryCap" 200;
- setAttr "defaultRenderGlobals.motionBlurType" 1;
- setAttr "defaultRenderGlobals.useDisplacementBoundingBox" yes;
- setAttr "defaultRenderGlobals.smoothColor" no;
- setAttr "defaultRenderGlobals.keepMotionVector" no;
- setAttr "defaultRenderGlobals.iprRenderShading" yes;
- setAttr "defaultRenderGlobals.iprRenderShadowMaps" yes;
- setAttr "defaultRenderGlobals.iprRenderMotionBlur" yes;
- setAttr "defaultRenderGlobals.renderLayerEnable" no;
- setAttr "defaultRenderGlobals.renderLayerPassEnable" no;
- setAttr "defaultRenderGlobals.renderGlobalPassEnable" no;
- setAttr "defaultRenderGlobals.renderLayerSubdirs" no;
- setAttr "defaultRenderGlobals.forceTileSize" no;
- setAttr "defaultRenderGlobals.tileWidth" 64;
- setAttr "defaultRenderGlobals.tileHeight" 64;
-
- // Set defaultRenderQuality to default values
- //
- setAttr "defaultRenderQuality.caching" no;
- setAttr "defaultRenderQuality.isHistoricallyInteresting" 2;
- setAttr "defaultRenderQuality.nodeState" 0;
- setAttr "defaultRenderQuality.reflections" 1;
- setAttr "defaultRenderQuality.refractions" 6;
- setAttr "defaultRenderQuality.shadows" 2;
- setAttr "defaultRenderQuality.rayTraceBias" 0;
- setAttr "defaultRenderQuality.edgeAntiAliasing" 3;
- setAttr "defaultRenderQuality.renderSample" no;
- setAttr "defaultRenderQuality.useMultiPixelFilter" no;
- setAttr "defaultRenderQuality.pixelFilterType" 2;
- setAttr "defaultRenderQuality.pixelFilterWidthX" 2.2000000476837158;
- setAttr "defaultRenderQuality.pixelFilterWidthY" 2.2000000476837158;
- setAttr "defaultRenderQuality.plugInFilterWeight" 1;
- setAttr "defaultRenderQuality.shadingSamples" 1;
- setAttr "defaultRenderQuality.maxShadingSamples" 8;
- setAttr "defaultRenderQuality.visibilitySamples" 1;
- setAttr "defaultRenderQuality.maxVisibilitySamples" 4;
- setAttr "defaultRenderQuality.volumeSamples" 1;
- setAttr "defaultRenderQuality.particleSamples" 1;
- setAttr "defaultRenderQuality.enableRaytracing" no;
- setAttr "defaultRenderQuality.redThreshold" 0.40000000596046448;
- setAttr "defaultRenderQuality.greenThreshold" 0.30000001192092896;
- setAttr "defaultRenderQuality.blueThreshold" 0.60000002384185791;
- setAttr "defaultRenderQuality.coverageThreshold" 0.125;
-
- // Set defaultResolution to default values
- //
- setAttr "defaultResolution.caching" no;
- setAttr "defaultResolution.isHistoricallyInteresting" 2;
- setAttr "defaultResolution.nodeState" 0;
- setAttr "defaultResolution.width" 320;
- setAttr "defaultResolution.height" 240;
- setAttr "defaultResolution.pixelAspect" 0;
- setAttr "defaultResolution.aspectLock" no;
- setAttr "defaultResolution.deviceAspectRatio" 1.3333300352096558;
- setAttr "defaultResolution.lockDeviceAspectRatio" no;
- setAttr "defaultResolution.oddFieldFirst" yes;
- setAttr "defaultResolution.fields" 0;
- setAttr "defaultResolution.zerothScanline" 0;
- }
-
- global proc buildRenderGlobalsPresetsMenu()
- {
- //
- // Description:
- // This procedure builds the Presets menu in the render globals window.
- //
-
- setParent renderGlobalsWindow;
- menu -edit -deleteAllItems presetsMenu;
-
- setParent -menu presetsMenu;
-
- menuItem
- -label "Save Settings as Preset..."
- -command ("saveNodePresetDialog");
-
- string $presetArray[];
- $presetArray = `nodePreset -list defaultRenderGlobals`;
-
- menuItem
- -label "Load Preset"
- -subMenu true;
-
- menuItem
- -label "Default Settings"
- -command
- ("renderGlobalsRevertToDefault; updateAllRenderGlobals;");
-
- menuItem -divider true;
-
- // Add a menu item for each available preset.
- //
- int $i;
- for ($i = 0; $i < size($presetArray); $i++)
- {
- menuItem
- -label $presetArray[$i]
- -command (
- "nodePreset -load defaultRenderGlobals \""
- + $presetArray[$i]
- + "\"; "
- + "nodePreset -load defaultRenderQuality \""
- + $presetArray[$i]
- + "\"; "
- + "nodePreset -load defaultResolution \""
- + $presetArray[$i]
- + "\"; "
- + "updateAllRenderGlobals");
- }
- setParent -menu ..; // from Load Preset menu
- menuItem
- -label "Delete Preset"
- -subMenu true;
-
- if (size($presetArray) == 0)
- {
- menuItem
- -label "No Presets Currently Exist"
- -enable false;
- }
- else
- {
- // Add a menu item to be able to delete each available preset.
- //
- int $i;
- for ($i = 0; $i < size($presetArray); $i++)
- {
- menuItem
- -label $presetArray[$i]
- -command (
- "nodePresetConfirmDeleteDialog \""
- + $presetArray[$i]
- + "\"; ");
- }
- }
- setParent -menu ..; // from Delete Preset menu
-
- menuItem
- -label "Set Preferred Preset"
- -subMenu true;
-
- int $preferredPresetExists;
- string $preferredPresetName;
-
- if (`optionVar -exists defaultRenderGlobalsPreferredPreset`)
- {
- $preferredPresetExists = true;
- $preferredPresetName =
- `optionVar -query defaultRenderGlobalsPreferredPreset`;
- }
-
- menuItem
- -label "Default Settings"
- -checkBox (!$preferredPresetExists)
- -command (
- "optionVar -remove defaultRenderGlobalsPreferredPreset;"
- + "optionVar -remove defaultRenderQualityPreferredPreset;"
- + "optionVar -remove defaultResolutionPreferredPreset;");
-
- menuItem -divider true;
-
- // Add a menu item to be able to set each available preset as your
- // preferred preset (to which render globals will be initialized
- // when you create a new file).
- //
- int $i;
- int $checkBoxValue;
-
- for ($i = 0; $i < size($presetArray); $i++)
- {
- $checkBoxValue = false;
- if ($preferredPresetExists)
- {
- $checkBoxValue = ($presetArray[$i] == $preferredPresetName);
- }
- menuItem
- -label $presetArray[$i]
- -checkBox $checkBoxValue
- -command (
- "optionVar -stringValue "
- + "\"defaultRenderGlobalsPreferredPreset\" \""
- + $presetArray[$i]
- + "\"; optionVar -stringValue "
- + "\"defaultRenderQualityPreferredPreset\" \""
- + $presetArray[$i]
- + "\"; optionVar -stringValue "
- + "\"defaultResolutionPreferredPreset\" \""
- + $presetArray[$i]
- + "\";");
- }
- setParent -menu ..; // from Set Preferred Preset menu
- }
-
- //==================================================================
- //
- // Starting the Window building section
- //
- //==================================================================
-
- global proc renderGlobalsWindow ()
- //
- // Procedure Name:
- // renderGlobalsWindow
- //
- // Description:
- // This procedure only builds the UI for the window.
- // The update* procedures make sure that the values are valid.
- // And the change* procedures do the editting of the values.
- //
- {
- // Unless the user has set the USE_OLD_RENDER_GLOBALS_WINDOW environment
- // variable, we will open the new unified render globals window.
- //
- if (size(`getenv "USE_OLD_RENDER_GLOBALS_WINDOW"`) == 0)
- {
- unifiedRenderGlobalsWindow();
- return;
- }
-
- // If the window exists already, just show it.
- //
- if (`window -exists renderGlobalsWindow`) {
- showWindow renderGlobalsWindow;
- updateAllRenderGlobals;
- return;
- }
-
- // Create the window
- //
- window -title "Render Globals"
- -wh 422 670 -tlc 200 220
- -mb true -retain
- -iconName "R.Globals" renderGlobalsWindow;
-
- // Set up the menus
- //
- menu -l "Edit";
- menuItem -l "Hardware Render Globals..."
- -c "editRenderGlobalsRW";
- menuItem -l "Change Project Image Directory..."
- -c "EditProject";
-
- menu -label "Presets"
- -postMenuCommand "buildRenderGlobalsPresetsMenu"
- presetsMenu;
-
- // Adds support for the Context Sensitive Help Menu.
- //
- addContextHelpProc "renderGlobalsWindow" "buildRenderGlobalsContextHelpItems";
-
- doHelpMenu "renderGlobalsWindow" "renderGlobalsWindow";
-
- setUITemplate -pushTemplate attributeEditorTemplate;
-
- formLayout rgMainForm;
-
- //--------------------------------------------------------------
- // Example File Name area
- //--------------------------------------------------------------
-
- frameLayout -labelVisible false -cll false -cl false exampleLayout;
- columnLayout -adjustableColumn true;
- text -align "left" -font "boldLabelFont" -label "" exampleText0;
- text -align "left" -font "boldLabelFont" -label "" exampleText1;
- text -align "left" -font "boldLabelFont" -label "" exampleText2;
-
- setParent ..;
- setParent ..;
-
- //--------------------------------------------------------------
- // Information area starts
- //--------------------------------------------------------------
-
- scrollLayout -hst 0 rgMainLayout;
- string $parent = `columnLayout -adjustableColumn true`;
-
- // Image File Name
- //
- frameLayout -label "Image File Output"
- -cll true -cl 0
- rgImageFileFrame;
-
- // This section defaults open so always create the UI
- createImageFile ("rgImageFileFrame");
-
- setParent ..;
-
- // Resolution Section
- //
- frameLayout -label "Resolution"
- -cll true -cl 1
- -preExpandCommand "createResolution (\"rgResolutionFrame\")"
- rgResolutionFrame;
- setParent ..;
-
- // Field Options
- //
- frameLayout -label "Field Options"
- -cll true -cl 1
- -preExpandCommand "createFieldOptions (\"rgFieldOptionsFrame\")"
- rgFieldOptionsFrame;
- setParent ..;
-
- // Anti-aliasing quality section
- //
- frameLayout -label "Anti-aliasing Quality"
- -cll true -cl 1
- -preExpandCommand "createRenderQuality (\"rgQualityFrame\")"
- rgQualityFrame;
- setParent ..;
-
- // Raytracing quality section
- //
- frameLayout -label "Raytracing Quality"
- -cll true -cl 1
- -preExpandCommand "createRayTraceQuality (\"rgRayTraceFrame\")"
- rgRayTraceFrame;
- setParent ..;
-
-
- // Extension Options
- //
- frameLayout -label "Modify Extension"
- -cll true -cl 1
- rgExtOptionsFrame;
-
- // Always create this since it is needed by the first section
- createExtensionOptions ("rgExtOptionsFrame");
-
- setParent ..;
-
- // Frame Options
- //
- frameLayout -label "Renumber Frames"
- -cll true -cl 1
- -preExpandCommand "createFrameOptions (\"rgFrameOptionsFrame\")"
- rgFrameOptionsFrame;
- setParent ..;
-
- // Motion Blur
- //
- frameLayout -label "Motion Blur"
- -cll true -cl 1
- -preExpandCommand "createMotionBlur (\"rgBlurFrame\")"
- rgBlurFrame;
- setParent ..;
-
- // Render Options
- //
- frameLayout -label "Render Options"
- -cll true -cl 1
- -preExpandCommand "createRenderOptions (\"rgOptionFrame\")"
- rgOptionFrame;
- setParent ..;
-
- // Performance Options
- //
- frameLayout -label "Memory and Performance Options"
- -cll true -cl 1
- -preExpandCommand "createPerformanceOptions (\"rgPerfFrame\")"
- rgPerfFrame;
- setParent ..;
-
- // IPR Options
- //
- frameLayout -label "IPR Options"
- -cll true -cl 1
- rgIPRFrame;
- createIPROptions("rgIPRFrame");
- setParent ..;
-
- // Render Layer/Pass Options
- //
- frameLayout -label "Render Layer/Pass Control"
- -cll true -cl 1
- -preExpandCommand "createRenderLayerOptions (\"rgRenderLayerFrame\")"
- rgRenderLayerFrame;
- setParent ..;
-
- if (`isTrue MayaCreatorExists`) {
- // Urchin Options
- frameLayout -label "Paint Effects Rendering Options"
- -cll true -cl 1
- -preExpandCommand "createUrchinOptions (\"rgUrchinFrame\")"
- rgUrchinFrame;
- setParent ..;
- }
-
- // These end off the layouts of the information area
- setParent ..;
- setParent ..;
-
- //--------------------------------------------------------------
- // Button area starts
- //--------------------------------------------------------------
-
- button -l "Close"
- -h 26
- -align "center"
- -c "window -e -vis 0 renderGlobalsWindow"
- rgCloseBtn;
-
- setParent ..;
-
- // Fix up the layout
-
- formLayout -edit
-
- -af exampleLayout "top" 0
- -af exampleLayout "left" 0
- -an exampleLayout "bottom"
- -af exampleLayout "right" 0
-
- -ac rgMainLayout "top" 5 exampleLayout
- -af rgMainLayout "left" 0
- -af rgMainLayout "right" 0
- -ac rgMainLayout "bottom" 5 rgCloseBtn
-
- -an rgCloseBtn "top"
- -af rgCloseBtn "bottom" 5
- -af rgCloseBtn "left" 5
- -af rgCloseBtn "right" 5
- rgMainForm;
-
- setUITemplate -popTemplate ;
-
- //--------------------------------------------------------------
- // Update and show window
- //--------------------------------------------------------------
-
- updateImageDirectory;
- updateImageFile;
- updateRenderableCamera;
- updateFrames;
- updateFileOutputFeedback;
-
- showWindow renderGlobalsWindow;
-
- // The -replacePrevious flag removes all scriptJobs from
- // this window. Then these two are added back.
- //
- scriptJob -p renderGlobalsWindow -replacePrevious
- -e SceneOpened updateAllRenderGlobals;
-
- scriptJob -p renderGlobalsWindow
- -e workspaceChanged updateImageDirectory;
-
- }
-
- global proc updateAllRenderGlobals()
- {
- updateImageFile;
- updateRenderableCamera;
- updateFrames;
- updateFileOutputFeedback;
- if (`frameLayout -q -cl rgResolutionFrame` == 0) {
- updateResolution;
- }
- if (`frameLayout -q -cl rgQualityFrame` == 0) {
- updateRenderQuality;
- }
- if (`frameLayout -q -cl rgRayTraceFrame` == 0) {
- updateRaytraceQuality;
- }
- if (`frameLayout -q -cl rgExtOptionsFrame` == 0) {
- updateExtOptions;
- }
- if (`frameLayout -q -cl rgFieldOptionsFrame` == 0) {
- updateFieldOptions;
- }
- if (`frameLayout -q -cl rgBlurFrame` == 0) {
- updateMotionBlur;
- }
- if (`frameLayout -q -cl rgOptionFrame` == 0) {
- updateRenderOptions;
- }
- if (`frameLayout -q -cl rgPerfFrame` == 0) {
- updatePerformanceOptions;
- }
- if (`frameLayout -q -cl rgIPRFrame` == 0) {
- updateIPROptions;
- }
- if (`frameLayout -q -cl rgRenderLayerFrame` == 0) {
- updateRenderLayerOptions;
- }
- if (`isTrue MayaCreatorExists`) {
- if (`frameLayout -q -cl rgUrchinFrame` == 0) {
- updateUrchinOptions;
- }
- }
- }
-
- global proc checkAspectLockWidth ( string $nodeName )
- {
- float $deviceAspect;
-
- if ( `getAttr ( $nodeName + ".aspectLock" )` ) {
- // AEadjustHeight
- int $value = `getAttr ( $nodeName + ".width" )`;
-
- float $aspect = `getAttr ( $nodeName + ".pixelAspect" )`;
-
- if ( $aspect > 0.0 ){
- int $rez = $aspect * $value;
- int $oldrez = `getAttr ( $nodeName + ".height" )`;
- if ($rez - $oldrez > 1 || $oldrez - $rez > 1) {
- setAttr ( $nodeName + ".height" ) $rez;
- }
- } else {
- checkAspectLock $nodeName;
- }
- }
-
- if ( `getAttr ( $nodeName + ".lockDeviceAspectRatio" )` == 0 ) {
- $deviceAspect = `getAttr ( $nodeName + ".width" )`;
- $deviceAspect = $deviceAspect / `getAttr ( $nodeName + ".height" )`;
- setAttr ( $nodeName + ".deviceAspectRatio" ) $deviceAspect;
- }
- }
-
- global proc checkAspectLockHeight ( string $nodeName )
- {
- float $deviceAspect;
-
- if ( `getAttr ( $nodeName + ".aspectLock" )` ) {
- // AEadjustWidth
- int $value = `getAttr ( $nodeName + ".height" )`;
-
- float $aspect = `getAttr ( $nodeName + ".pixelAspect" )`;
-
- if ( $aspect > 0.0 ){
- int $rez = $value / $aspect;
- int $oldrez = `getAttr ( $nodeName + ".width" )`;
- if ($rez - $oldrez > 1 || $oldrez - $rez > 1) {
- setAttr ( $nodeName + ".width" ) $rez;
- }
- } else {
- checkAspectLock $nodeName;
- }
- }
-
- if ( `getAttr ( $nodeName + ".lockDeviceAspectRatio" )` == 0 ) {
- $deviceAspect = `getAttr ( $nodeName + ".width" )`;
- $deviceAspect = $deviceAspect / `getAttr ( $nodeName + ".height" )`;
- setAttr ( $nodeName + ".deviceAspectRatio" ) $deviceAspect;
- }
- }
-
- global proc checkAspectLock ( string $nodeName )
- {
- // AEadjustPixelAspect
- int $lockOn = `getAttr ( $nodeName + ".aspectLock" )`;
-
- if ($lockOn) {
- float $h = `getAttr ( $nodeName + ".height" )`;
- float $w = `getAttr ( $nodeName + ".width" )`;
- float $aspect = $h / $w;
- setAttr ( $nodeName + ".pixelAspect" ) $aspect;
- } else {
- setAttr ( $nodeName + ".pixelAspect" ) 0.0;
- }
- }
-
- global proc rgPixelAspectReplace(string $nodeName)
- {
- string $aspectAttr = $nodeName + ".deviceAspectRatio";
- string $widthAttr = $nodeName + ".width";
- string $heightAttr = $nodeName + ".height";
- float $aspect = (float) `getAttr $widthAttr` / (float) `getAttr $heightAttr`;
- $aspect = `getAttr $aspectAttr` / $aspect;
-
- floatFieldGrp -e -v1 $aspect pixRatio;
- }
-
- global proc rgAdjustPixelAspect(string $nodeName)
- {
- setParent renderGlobalsWindow;
- string $aspectAttr = $nodeName + ".deviceAspectRatio";
- string $widthAttr = $nodeName + ".width";
- string $heightAttr = $nodeName + ".height";
- float $pixelAspect = (float) `getAttr $widthAttr`
- / (float) `getAttr $heightAttr`;
- $pixelAspect = `getAttr $aspectAttr` / $pixelAspect;
- floatFieldGrp -e -v1 $pixelAspect pixRatio;
- }
-
- global proc rgAdjustDeviceAspect(string $nodeName)
- {
- setParent renderGlobalsWindow;
- string $devAspectAttr = $nodeName + ".deviceAspectRatio";
- string $widthAttr = $nodeName + ".width";
- string $heightAttr = $nodeName + ".height";
-
- float $pixelAspect = `floatFieldGrp -q -v1 pixRatio`;
- float $aspect = (float) `getAttr $widthAttr`
- / (float) `getAttr $heightAttr`;
- $aspect = $pixelAspect * $aspect;
- setAttr $devAspectAttr $aspect;
- floatFieldGrp -edit -v1 $aspect resRatio;
- }
-
- global proc updateDeviceAspectRatio()
- {
- setAttr defaultResolution.deviceAspectRatio
- `floatFieldGrp -q -v1 resRatio`;
- rgAdjustPixelAspect "defaultResolution";
- updateResolution;
- }
-
- global proc updateRenderLayerLayout( int $doLayers, int $doPasses )
- {
- updateRenderLayerFilters;
-
- if ( $doLayers )
- {
- if ( $doPasses )
- {
- spreadSheetEditor
- -e
- -filter renderLayerFilter
- -fal {"rndr","b","cp","s","di","sp"}
- "layerOutliner";
-
- }
- else
- {
- spreadSheetEditor
- -e
- -filter renderLayerFilter
- -fal {"rndr"}
- "layerOutliner";
-
- }
-
- checkBoxGrp -e
- -ed true
- -en1 true
- renderLayerPassEnable;
-
- checkBoxGrp -e
- -ed false
- -en1 false
- renderGlobalPassEnable;
-
- frameLayout
- -e
- -m true
- "layerAttrLayout";
-
- }
- else
- {
- if ( $doPasses )
- {
- spreadSheetEditor
- -e
- -filter glblRenderFilter
- -fal {"b","cp","s","di","sp"}
- "layerOutliner";
-
- frameLayout
- -e
- -m true
- "layerAttrLayout";
-
- }
- else
- {
- frameLayout
- -e
- -m false
- "layerAttrLayout";
- }
-
- checkBoxGrp -e
- -ed true
- -en1 true
- renderGlobalPassEnable;
-
- checkBoxGrp -e
- -ed false
- -en1 false
- renderLayerPassEnable;
- }
- }
-
- global proc updateRenderLayerOptions ()
- //
- // Procedure Name:
- // updateRenderLayerOptions
- //
- // Description:
- // Gets the real values from the option vars and sets the UI based
- // on these values. This procedure updates all of the RL/RP
- // values.
- //
- {
- int $doLayers = `getAttr "defaultRenderGlobals.renderLayerEnable"`;
- checkBoxGrp -edit -v1 $doLayers renderLayerEnable;
-
- int $doLayerPasses = `getAttr "defaultRenderGlobals.renderLayerPassEnable"`;
- checkBoxGrp -edit -v1 $doLayerPasses renderLayerPassEnable;
-
- int $doGlobalPasses = `getAttr "defaultRenderGlobals.renderGlobalPassEnable"`;
- checkBoxGrp -edit -v1 $doGlobalPasses renderGlobalPassEnable;
-
- int $doSubdirs = `getAttr "defaultRenderGlobals.renderLayerSubdirs"`;
- checkBoxGrp -edit -v1 $doSubdirs renderLayerSubdirs;
-
- if ( $doLayers ) {
- updateRenderLayerLayout( true, $doLayerPasses );
- }
- else {
- updateRenderLayerLayout( false, $doGlobalPasses );
- }
- }
-
- global proc updateRenderLayerEnable()
- {
- int $doPasses;
- int $doLayers = `checkBoxGrp -q -v1 renderLayerEnable`;
- setAttr defaultRenderGlobals.renderLayerEnable $doLayers;
- if ( $doLayers ) {
- $doPasses = `checkBoxGrp -q -v1 renderLayerPassEnable`;
- }
- else {
- $doPasses = `checkBoxGrp -q -v1 renderGlobalPassEnable`;
- }
-
- updateRenderLayerLayout( $doLayers, $doPasses );
- }
-
- global proc updateRenderLayerPassEnable()
- {
- int $doLayers = `checkBoxGrp -q -v1 renderLayerEnable`;
- int $doPasses = `checkBoxGrp -q -v1 renderLayerPassEnable`;
- setAttr defaultRenderGlobals.renderLayerPassEnable $doPasses;
- updateRenderLayerLayout( $doLayers, $doPasses );
- }
-
- global proc updateRenderGlobalPassEnable()
- {
- int $doLayers = `checkBoxGrp -q -v1 renderLayerEnable`;
- int $doPasses = `checkBoxGrp -q -v1 renderGlobalPassEnable`;
- setAttr defaultRenderGlobals.renderGlobalPassEnable $doPasses;
- updateRenderLayerLayout( $doLayers, $doPasses );
- }
-
- //global proc updateRenderLayerSubdirs()
- //{
- //int $doSubdirs = `checkBoxGrp -q -v1 renderLayerSubdirs`;
- //setAttr defaultRenderGlobals.renderLayerSubdirs $doPasses;
- //////////optionVar -intValue renderLayerSubdirs $doSubdirs;
- //}
-
-
- global proc createRenderLayerOptions (string $parent)
- //
- // Procedure Name:
- // createRenderLayerOptions
- //
- // Description:
- // Creates the UI in the "Render Layer/Pass Control"
- // expand/collapse section.
- //
- {
- setUITemplate -pushTemplate attributeEditorTemplate;
-
- setParent $parent;
- string $cName;
-
- // Set up the spreadsheet filters
- updateRenderLayerFilters;
-
- // If the UI is created already then just update the attribute values.
- if (`columnLayout -exists rgRenderLayerLayout`) {
- updateRenderLayerOptions;
- return;
- }
-
- //columnLayout -adjustableColumn true rgRenderLayerLayout;
- columnLayout -adjustableColumn true rgRenderLayerLayout;
- checkBoxGrp -numberOfCheckBoxes 1
- -label1 "Enable Render Layers"
- -cc "updateRenderLayerEnable"
- renderLayerEnable;
-
-
- checkBoxGrp -numberOfCheckBoxes 1
- -label1 "Enable Render Layer Passes"
- -cc "updateRenderLayerPassEnable"
- renderLayerPassEnable;
-
- checkBoxGrp -numberOfCheckBoxes 1
- -label1 "Enable Global Passes"
- -cc "updateRenderGlobalPassEnable"
- renderGlobalPassEnable;
-
- separator;
-
- checkBoxGrp -numberOfCheckBoxes 1
- -label1 "Output to Subdirectories"
- //-cc "updateRenderLayerSubdirs"
- -cc "setAttr defaultRenderGlobals.renderLayerSubdirs #1"
- renderLayerSubdirs;
-
- //columnLayout bbby;
- //setParent ..;
- //button -label "Save Composition File...";
-
- frameLayout
- -label "Render Layers"
- -labelVisible false
- -borderVisible false
- -collapsable false
- // -m false
- layerAttrLayout;
-
- columnLayout -adjustableColumn true layerLyt;
-
- separator;
-
- selectionConnection -wl -parent layerLyt aList;
- spreadSheetEditor
- -mainListConnection aList
- -ko false
- -ln true
- -fal {"rndr"}
- -filter renderLayerFilter
- layerOutliner;
- setParent ..;
-
- setParent ..;
-
- setParent ..;
-
- setUITemplate -popTemplate;
-
- // Make sure the values are right
- updateRenderLayerOptions;
- }
-